Uma área de pesquisa sobre o WordPress para devs e autores do tema



add_role ›

Desde2.0.0
Obsoleton/a
add_role ( $role, $display_name, $capabilities = array() )
Parâmetros: (3)
  • (string) $role Role name.
    Required: Yes
  • (string) $display_name Display name for role.
    Required: Yes
  • (array) $capabilities List of capabilities, e.g. array( 'edit_posts' => true, 'delete_posts' => false );
    Required: No
    Padrão: array()
Retorna:
  • (WP_Role|null) WP_Role object if role is added, null if already exists.
Definido em:
Codex:

Add role, if it does not exist.



Funções relacionadas: add_filter, add_link, add_meta, add_user, add_feed

Fonte

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