Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to Assign Multiple Roles for a user in wordpress?

Tags:

wordpress

I know how to assign a single role for a user. But coming to the multiple roles for a user is not working...Is wordpress gives this facility or not.Thanks in advance.

like image 371
sasi kanth Avatar asked Dec 11 '14 10:12

sasi kanth


1 Answers

Yes, WordPress allows this. You can do it in your code:

    $someone = new WP_User( $user_id );
    $someone->add_role( 'role-1' );
    $someone->add_role( 'role-2' );

You can also use a plugin such as Multiple Roles. The plugin will transform the select dropdown into checkboxes.

WordPress — Role selection checkboxes

like image 121
Christian Lescuyer Avatar answered Oct 23 '22 00:10

Christian Lescuyer