is_user_admin()WP 3.1.0

Whether the current request is for a user admin screen.

e.g. /wp-admin/user/

Does not check if the user is an administrator; use current_user_can() for checking roles and capabilities.

No Hooks.

Return

true|false. True if inside WordPress user administration pages.

Usage

is_user_admin();

Examples

0

#1 Display the link to the profile in /user/ if we are already in this section.

Example from the get_edit_profile_url() function code.

    if ( is_user_admin() )
		$url = user_admin_url( 'profile.php', $scheme );
	elseif ( is_network_admin() )
		$url = network_admin_url( 'profile.php', $scheme );
	else
		$url = get_dashboard_url( $user_id, 'profile.php', $scheme );

Notes

  • Global. WP_Screen. $current_screen WordPress current screen object.

Changelog

Since 3.1.0 Introduced.

Code of is_user_admin() WP 6.0.1

function is_user_admin() {
	if ( isset( $GLOBALS['current_screen'] ) ) {
		return $GLOBALS['current_screen']->in_admin( 'user' );
	} elseif ( defined( 'WP_USER_ADMIN' ) ) {
		return WP_USER_ADMIN;
	}

	return false;
}