Yoast\WP\SEO\Conditionals

Yoast_Admin_And_Dashboard_Conditional::is_met()publicYoast 1.0

Returns true when on the admin dashboard, update or Yoast SEO pages.

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

Хуков нет.

Возвращает

true|false. true when on the admin dashboard, update or Yoast SEO pages.

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

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

Код Yoast_Admin_And_Dashboard_Conditional::is_met() Yoast 22.4

public function is_met() {
	global $pagenow;

	// Bail out early if we're not on the front-end.
	if ( ! \is_admin() ) {
		return false;
	}

	// Do not output on plugin / theme upgrade pages or when WordPress is upgrading.
	if ( ( \defined( 'IFRAME_REQUEST' ) && \IFRAME_REQUEST ) || $this->on_upgrade_page() || \wp_installing() ) {
		return false;
	}

	if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && \strpos( $_GET['page'], 'wpseo' ) === 0 ) {
		return true;
	}

	$target_pages = [
		'index.php',
		'plugins.php',
		'update-core.php',
		'options-permalink.php',
	];

	return \in_array( $pagenow, $target_pages, true );
}