is_admin()
Determines whether the current request is for an administrative interface page.
Description #Description
Does not check if the user is an administrator; use current_user_can() for checking roles and capabilities.
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
Return #Return
(bool) True if inside WordPress administration interface, false otherwise.
Source #Source
File: wp-includes/load.php
function is_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin(); } elseif ( defined( 'WP_ADMIN' ) ) { return WP_ADMIN; } return false; }
Expand full source code Collapse full source code View on Trac
Changelog #Changelog
Version | Description |
---|---|
1.5.1 | Introduced. |
Related #Related
Used By #Used By
Used By | Description |
---|---|
wp-includes/blocks/categories.php: render_block_core_categories() |
Renders the |
wp-includes/l10n.php: determine_locale() |
Determine the current locale desired for the request. |
wp-includes/script-loader.php: wp_common_block_scripts_and_styles() |
Handles the enqueueing of block scripts and styles that are common to both the editor and the front-end. |
wp-admin/includes/plugin.php: wp_add_privacy_policy_content() |
Helper function for adding content to the Privacy Policy Guide. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::establish_loaded_changeset() |
Establish the loaded changeset. |
wp-includes/class-wp-editor.php: _WP_Editors::enqueue_default_editor() |
Enqueue all editor scripts. |
wp-includes/class-wp-taxonomy.php: WP_Taxonomy::set_props() |
Sets taxonomy properties. |
wp-includes/class-wp-taxonomy.php: WP_Taxonomy::add_rewrite_rules() |
Adds the necessary rewrite rules for the taxonomy. |
wp-includes/class-wp-post-type.php: WP_Post_Type::add_rewrite_rules() |
Adds the necessary rewrite rules for the post type. |
wp-includes/class-wp-post-type.php: WP_Post_Type::set_props() |
Sets post type properties. |
wp-includes/rest-api.php: get_rest_url() |
Retrieves the URL to a REST endpoint on a site. |
wp-includes/admin-bar.php: wp_admin_bar_customize_menu() |
Adds the “Customize” link to the Toolbar. |
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php: WP_Customize_Nav_Menu_Item_Setting::sort_wp_get_nav_menu_items() |
Re-apply the tail logic also applied on $items by wp_get_nav_menu_items(). |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::wp_loaded() |
Register styles/scripts and initialize the preview of each setting |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::wp_redirect_status() |
Prevents Ajax requests from following redirects when previewing a theme by issuing a 200 response instead of a 30x. |
wp-includes/theme.php: add_editor_style() |
Add callback for custom TinyMCE editor stylesheets. |
wp-includes/theme.php: remove_editor_styles() |
Removes all visual editor stylesheets. |
wp-includes/theme.php: _custom_header_background_just_in_time() |
Registers the internal custom header and background routines. |
wp-includes/theme.php: _wp_customize_include() |
Includes and instantiates the WP_Customize_Manager class. |
wp-includes/theme.php: switch_theme() |
Switches the theme. |
wp-includes/theme.php: get_theme_mods() |
Retrieve all theme modifications. |
wp-includes/l10n.php: load_default_textdomain() |
Load default translated strings based on locale. |
wp-includes/general-template.php: wp_heartbeat_settings() |
Default settings for heartbeat |
wp-includes/deprecated.php: wp_admin_bar_dashboard_view_site_menu() |
Add the “Dashboard”/”Visit Site” menu. |
wp-includes/class-wp-theme.php: WP_Theme::get_allowed_on_site() |
Returns array of stylesheet names of themes allowed on the site. |
wp-includes/class-wp.php: WP::handle_404() |
Set the Headers for 404, if nothing is found for requested URL. |
wp-includes/class-wp.php: WP::parse_request() |
Parse request to find correct WordPress query. |
wp-includes/class-wp-query.php: WP_Query::parse_query() |
Parse a query string and set query type booleans. |
wp-includes/functions.wp-scripts.php: wp_deregister_script() |
Remove a registered script. |
wp-includes/functions.php: wp_auth_check_load() |
Load the auth check for monitoring whether the user is still logged in. |
wp-includes/widgets.php: wp_widget_rss_output() |
Display the RSS entries in a list. |
wp-includes/link-template.php: network_home_url() |
Retrieves the home URL for the current network. |
wp-includes/link-template.php: get_home_url() |
Retrieves the URL for a given site where the front end is accessible. |
wp-includes/link-template.php: get_pagenum_link() |
Retrieves the link for a page number. |
wp-includes/class-wp-admin-bar.php: WP_Admin_Bar::_render() | |
wp-includes/admin-bar.php: wp_admin_bar_sidebar_toggle() |
Add the sidebar toggle button. |
wp-includes/admin-bar.php: wp_admin_bar_site_menu() |
Add the “Site Name” menu. |
wp-includes/admin-bar.php: wp_admin_bar_edit_menu() |
Provide an edit link for posts and terms. |
wp-includes/admin-bar.php: wp_admin_bar_search_menu() |
Add search form. |
wp-includes/admin-bar.php: is_admin_bar_showing() |
Determines whether the admin bar should be showing. |
wp-includes/option.php: wp_user_settings() |
Saves and restores user interface settings stored in a cookie. |
wp-includes/post-template.php: get_post_class() |
Retrieves an array of the class names for the post container element. |
wp-includes/post-template.php: get_the_title() |
Retrieve post title. |
wp-includes/media.php: wp_enqueue_media() |
Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
wp-includes/media.php: wp_video_shortcode() |
Builds the Video shortcode output. |
wp-includes/media.php: image_constrain_size_for_editor() |
Scale down the default size of an image. |
wp-includes/post.php: wp_get_attachment_url() |
Retrieve the URL for an attachment. |
wp-includes/canonical.php: redirect_canonical() |
Redirects incoming links to the proper URL based on the site url. |
wp-includes/ms-load.php: ms_not_installed() |
Displays a failure message. |
wp-includes/post-formats.php: _post_format_request() |
Filters the request to allow for the format prefix. |
wp-includes/nav-menu.php: wp_get_nav_menu_items() |
Retrieves all menu items of a navigation menu. |
wp-includes/widgets.php: wp_get_sidebars_widgets() |
Retrieve full list of sidebars and their widget instance IDs. |
wp-includes/widgets.php: wp_convert_widget_settings() |
Convert the widget settings from single to multi-widget format. |
wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::schedule_customize_register() |
Ensures widgets are available for all types of previews. |
wp-includes/script-loader.php: script_concat_settings() |
Determine the concatenation and compression settings for scripts and styles. |
wp-includes/script-loader.php: wp_default_scripts() |
Register all WordPress scripts. |
wp-includes/class-wp-editor.php: _WP_Editors::editor_settings() | |
wp-includes/class-wp-editor.php: _WP_Editors::editor_js() |
Print (output) the TinyMCE configuration and initialization scripts. |
User Contributed Notes #User Contributed Notes
You must log in before being able to contribute a note or feedback.
Be aware that ‘is_admin()’ will return ‘false’ while in the theme customizer view, despite essentially being in the admin dashboard. To test for the customizer, use ‘is_customize_preview()’.
Example: