Answers for "update current user role wordpress"

PHP
2

wordpress get current user role

$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
    //The user has the "author" role
}
Posted by: Guest on February-13-2021
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

Code answers related to "update current user role wordpress"

Browse Popular Code Answers by Language