W3cubDocs

/WordPress

WP_Screen::in_admin( string $admin = null )

Indicates whether the screen is in a particular admin

Parameters

$admin

(string) (Optional) The admin to check against (network | user | site). If empty any of the three admins will result in true.

Default value: null

Return

(bool) True if the screen is in the indicated admin, false otherwise.

Source

File: wp-admin/includes/class-wp-screen.php

public function in_admin( $admin = null ) {
		if ( empty( $admin ) ) {
			return (bool) $this->in_admin;
		}

		return ( $admin === $this->in_admin );
	}

Changelog

Version Description
3.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_screen/in_admin