Un motore di ricerca WordPress per sviluppatori e autori di temi



user_can ›

Da3.1.0
Deprecaton/a
user_can ( $user, $capability )
Parametri: (2)
  • (int|WP_User) $user User ID or object.
    Richiesto:
  • (string) $capability Capability name.
    Richiesto:
Ritorna:
  • (bool) Whether the user has the given capability.
Definito a:
Codex:

Whether a particular user has a specific capability.



Sorgenti

function user_can( $user, $capability ) {
	if ( ! is_object( $user ) ) {
		$user = get_userdata( $user );
	}

	if ( ! $user || ! $user->exists() ) {
		return false;
	}

	$args = array_slice( func_get_args(), 2 );
	$args = array_merge( array( $capability ), $args );

	return call_user_func_array( array( $user, 'has_cap' ), $args );
}