WP_Screen::in_admin()publicWP 3.5.0

Indicates whether the screen is in a particular admin.

Method of the class: WP_Screen{}

No Hooks.

Return

true|false. True if the screen is in the indicated admin, false otherwise.

Usage

$WP_Screen = new WP_Screen();
$WP_Screen->in_admin( $admin );
$admin(string)
The admin to check against (network | user | site). If empty any of the three admins will result in true.
Default: null

Changelog

Since 3.5.0 Introduced.

WP_Screen::in_admin() code WP 6.5.2

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

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