Answers for "wordpress create user role programmatically"

0

from user id to user role wordpress

$user_meta = get_userdata( $user_id );

$user_roles = $user_meta->roles; // array with all the roles the user is part of.
Posted by: Guest on October-14-2020
0

update user role wordpress

$wp_user_object = new WP_User($current_user->ID);
$wp_user_object->set_role('editor');
Posted by: Guest on December-18-2020
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

Code answers related to "wordpress create user role programmatically"

Browse Popular Code Answers by Language