Yoast\WP\SEO\Conditionals

Primary_Category_Conditional::is_met()publicYoast 1.0

Returns true when on the frontend, or when on the post overview, post edit or new post admin page, or when on additional admin pages, allowed by filter.

Метод класса: Primary_Category_Conditional{}

Хуки из метода

Возвращает

true|false. true when on the frontend, or when on the post overview, post edit, new post admin page or additional admin pages, allowed by filter.

Использование

$Primary_Category_Conditional = new Primary_Category_Conditional();
$Primary_Category_Conditional->is_met();

Код Primary_Category_Conditional::is_met() Yoast 20.0

public function is_met() {
	if ( ! \is_admin() ) {
		return true;
	}
	/**
	 * Filter: Adds the possibility to use primary category at additional admin pages.
	 *
	 * @param array $admin_pages List of additional admin pages.
	 */
	$additional_pages = \apply_filters( 'wpseo_primary_category_admin_pages', [] );
	return \in_array( $this->current_page->get_current_admin_page(), \array_merge( [ 'edit.php', 'post.php', 'post-new.php' ], $additional_pages ), true );
}