I want to programmatically add the current user to a role and also remove the current user from a role in a php page i created . am really stuck. thanks in advance

| improve this question | | | | |

You can do that like this :

$my_user = new WP_User( $user_id );
$my_user->set_role( "editor" );
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.