is_admin() WordPress Function
The is_admin() function is used to check if the current user is an administrator. This function returns true if the user is an administrator, false otherwise.
is_admin() #
Determines whether the current request is for an administrative interface page.
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
(bool) True if inside WordPress administration interface, false otherwise.
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 codeCollapse full source codeView on TracView on GitHub
Related
Used By
Used By | Description |
---|---|
wp-includes/global-styles-and-settings.php:wp_get_global_styles_svg_filters() | Returns a string containing the SVGs to be referenced as filters (duotone). |
wp-includes/script-loader.php:_wp_theme_json_webfonts_handler() | Runs the theme.json webfonts handler. |
wp-includes/script-loader.php:wp_global_styles_render_svg_filters() | Renders the SVG filters supplied by theme.json. |
wp-includes/global-styles-and-settings.php:wp_get_global_stylesheet() | Returns the stylesheet resulting of merging core, theme, and user data. |
wp-includes/media.php:wp_get_loading_attr_default() | Gets the default value to use for a |
wp-includes/admin-bar.php:wp_admin_bar_edit_site_menu() | Adds the “Edit site” link to the Toolbar. |
wp-includes/script-loader.php:wp_should_load_separate_core_block_assets() | Checks whether separate styles should be loaded for core blocks on-render. |
wp-includes/script-loader.php:wp_get_inline_script_tag() | Wraps inline JavaScript in |
wp-includes/script-loader.php:wp_sanitize_script_attributes() | Sanitizes an attributes array into an attributes string to be placed inside a |
wp-includes/script-loader.php:wp_get_script_tag() | Formats |
wp-includes/load.php:wp_is_site_protected_by_basic_auth() | Checks if this site is protected by HTTP Basic Auth. |
wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php:WP_REST_Site_Health_Controller::load_admin_textdomain() | Loads the admin textdomain for Site Health tests. |
wp-includes/load.php:is_protected_endpoint() | Determines whether we are currently on an endpoint that should be protected against WSODs. |
wp-includes/class-wp-fatal-error-handler.php:WP_Fatal_Error_Handler::handle() | Runs the shutdown handler. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::check_wp_version_check_exists() | Test if |
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-includes/script-loader.php:wp_enqueue_registered_block_scripts_and_styles() | Enqueues registered block scripts and styles, depending on current rendered context (only enqueuing editor scripts while in context of the editor). |
wp-admin/includes/plugin.php:wp_add_privacy_policy_content() | Declares a helper function for adding content to the Privacy Policy Guide. |
wp-includes/class-wp-customize-manager.php:WP_Customize_Manager::establish_loaded_changeset() | Establishes 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() | Registers 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/class.wp-styles.php:WP_Styles::__construct() | Constructor. |
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() | Retrieves 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() | Parses the request to find the 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: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() | Adds the sidebar toggle button. |
wp-includes/admin-bar.php:wp_admin_bar_site_menu() | Adds the “Site Name” menu. |
wp-includes/admin-bar.php:wp_admin_bar_edit_menu() | Provides an edit link for posts and terms. |
wp-includes/admin-bar.php:wp_admin_bar_search_menu() | Adds 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() | Retrieves the 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/class.wp-scripts.php:WP_Scripts::init() | Initialize the class. |
wp-includes/nav-menu.php:wp_get_nav_menu_items() | Retrieves all menu items of a navigation menu. |
wp-includes/widgets.php:dynamic_sidebar() | Display dynamic sidebar. |
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() | Converts 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() | Determines the concatenation and compression settings for scripts and styles. |
wp-includes/script-loader.php:wp_default_scripts() | Registers 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. |
Changelog
Version | Description |
---|---|
1.5.1 | Introduced. |