Yoast\WP\SEO\Helpers
First_Time_Configuration_Notice_Helper::on_wpseo_admin_page_or_dashboard
Whether the user is currently visiting one of our admin pages or the WordPress dashboard.
Метод класса: First_Time_Configuration_Notice_Helper{}
Хуков нет.
Возвращает
true|false. Whether the current page is a Yoast SEO admin page
Использование
// private - только в коде основоного (родительского) класса $result = $this->on_wpseo_admin_page_or_dashboard();
Код First_Time_Configuration_Notice_Helper::on_wpseo_admin_page_or_dashboard() First Time Configuration Notice Helper::on wpseo admin page or dashboard Yoast 26.5
private function on_wpseo_admin_page_or_dashboard() {
$pagenow = $GLOBALS['pagenow'];
// Show on the WP Dashboard.
if ( $pagenow === 'index.php' ) {
return true;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['page'] ) && \is_string( $_GET['page'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information and only comparing the variable in a condition.
$page_from_get = \wp_unslash( $_GET['page'] );
// Show on Yoast SEO pages, with some exceptions.
if ( $pagenow === 'admin.php' && \strpos( $page_from_get, 'wpseo' ) === 0 ) {
$exceptions = [
'wpseo_installation_successful',
'wpseo_installation_successful_free',
];
if ( ! \in_array( $page_from_get, $exceptions, true ) ) {
return true;
}
}
}
return false;
}