Un motore di ricerca WordPress per sviluppatori e autori di temi



add_role ›

Da2.0.0
Deprecaton/a
add_role ( $role, $display_name, $capabilities = array() )
Parametri: (3)
  • (string) $role Role name.
    Richiesto:
  • (string) $display_name Display name for role.
    Richiesto:
  • (array) $capabilities List of capabilities, e.g. array( 'edit_posts' => true, 'delete_posts' => false );
    Richiesto: No
    Default: array()
Ritorna:
  • (WP_Role|null) WP_Role object if role is added, null if already exists.
Definito a:
Codex:

Add role, if it does not exist.



Funzioni correlate: add_filter, add_link, add_meta, add_user, add_feed

Sorgenti

function add_role( $role, $display_name, $capabilities = array() ) {
	if ( empty( $role ) ) {
		return;
	}
	return wp_roles()->add_role( $role, $display_name, $capabilities );
}