ChatGPT comes up with this code, what do you think? 🙂
$user_id = 123;
$new_role = 'editor';
$user_data = array(
'ID' => $user_id,
'role' => $new_role
);
wp_update_user($user_data);
Also, I would use as a trigger a plugin (automatewoo) and only want to use the custom code for the action – how do I change the code in this case? Thanks
Hey @missveronicatv , thanks very much, i am about to try this.
What would be the code, if i want to replace the specific role with another specific role? I will also ask chatgpt, but thanks alot 🙂