is_admin() – Determines whether the current request is for an administrative interface page.

You appear to be a bot. Output may be restricted

Description

Determines whether the current request is for an administrative interface page.

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 {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook.

Usage

$bool = is_admin();

Parameters

Returns

bool True if inside WordPress administration interface, false otherwise.

Source

File name: wordpress/wp-includes/load.php
Lines:

1 to 9 of 9
function is_admin() {
  if ( isset( $GLOBALS['current_screen'] ) ) {
    return $GLOBALS['current_screen']->in_admin();
  } elseif ( defined( 'WP_ADMIN' ) ) {
    return WP_ADMIN;
  }

  return false;
}
 

 View on GitHub View on Trac