This is one of those hacks that allows you to bypass hacking the database directly for what is just a simple thing to do. Change the user role of a WordPress user.
If you find yourself, for whatever reason, not being able to change a WordPress user’s role via the Dashboard, here’s your best alternative. Via WP CLI.
Time needed: 1 minute
If you find yourself, for whatever reason, not being able to change a WordPress user’s role via the Dashboard, here’s your best alternative. Via WP CLI.
- Connect to your site
Find your favorite Terminal app and connect via SSH to your WordPress site.
- Navigate to the root folder of your WordPress site
9 out of 10 times you can only use WP CLI commands when you’ve navigated to the root of your WordPress installation. An easy way to check where you are is to use the
ls
command. That will show you what files are in the directory where you are. - Update the user role
Copy and paste the following command to your terminal
wp user set-role username administrator
Make sure to change theusername
to the username you want to change it and hit enter. - Check and double check again
If all went well you will see no errors after hitting enter. Double check in the WordPress User overview if your change was what you intended.
Alternatively, you can use the following command to check the usernames + user roles via the terminal you’re already finding yourself in:wp user list
That’s it. All done. Want to learn more about what you can do with WP CLI? Check out my courses.