wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi
wp_admin_page_exists › WordPress Function
Da7.2.0
Deprecaton/a
› wp_admin_page_exists ( Nessun parametro )
| Ritorna: |
|
| Definito a: |
|
| Codex: |
Determines whether the requested admin page is registered.
This does not check whether the current user has the capability to access the page, only whether the page itself exists. Pages registered for a capability the current user lacks are recorded in the no-privilege registries rather than in $_registered_pages, and are still considered to exist so that the caller can report a permission error instead of a "page not found" error.Funzioni correlate: wp_admin_css, _wp_admin_bar_init, get_admin_page_parent, domain_exists, wp_admin_bar_edit_menu
Sorgenti
function wp_admin_page_exists(): bool {
global $plugin_page, $_registered_pages, $_wp_menu_nopriv, $_wp_submenu_nopriv,
$_wp_nopriv_pages;
if ( ! isset( $plugin_page ) ) {
return true;
}
$hookname = get_plugin_page_hookname( $plugin_page, get_admin_page_parent() );
if ( isset( $_registered_pages[ $hookname ] ) ) {
return true;
}
// The page may be registered for a capability the current user lacks.
if ( isset( $_wp_menu_nopriv[ $plugin_page ] ) || isset( $_wp_nopriv_pages[ $plugin_page ] ) ) {
return true;
}
return array_any(
(array) $_wp_submenu_nopriv,
fn( $nopriv_submenus ) => isset( $nopriv_submenus[ $plugin_page ] )
);
}