Answers for "wordpress user roles"

PHP
0

how to get all roles in wordpress

/* get all role in wordpress in associative key = role(slug) => value(Role Display name) by [email protected]  */
function get_role_names() {

global $wp_roles;

if ( ! isset( $wp_roles ) )
    $wp_roles = new WP_Roles();

return $wp_roles->get_names();
}
Posted by: Guest on January-27-2021
0

wordpress get wp roles

function get_role_names() {

global $wp_roles;

if ( ! isset( $wp_roles ) )
    $wp_roles = new WP_Roles();

return $wp_roles->get_names();
}
Posted by: Guest on April-01-2021
0

wordpress create user role programmatically

function ui_new_role() {  
 
    //add the new user role
    add_role(
        'power_member',
        'Power Member',
        array(
            'read'         => true,
            'delete_posts' => false
        )
    );
 
}
add_action('admin_init', 'ui_new_role');
Posted by: Guest on October-18-2021

Browse Popular Code Answers by Language