A rare situation, but in those rare instances when your website has been hacked and your WordPress user account has been changed from the role of Administrator to something else entirely, it may be easiest to simply change your WordPress user account back to Administrator using phpMyAdmin.
To change your WordPress user account from Subscriber to Administrator, first log into your cPanel. Then click the “phpMyAdmin” button.
You’ll see your list of installed databases at left.
If you are not sure which database your WordPress installation is using, then use your cPanel -> “File Manger” to “Edit” the contents of your WordPress configuration file, wp-config.php file.
Back to phpMyAdmin. Click your database and scroll down until you find the ‘usermeta
‘ table.
My goal here is to change the user lmadmin1 from Subscriber to Administrator.
Doing so is fairly easy.
After clicking the ‘usermeta
‘ table, all I need to do is scroll down within the table until lmadmin1 appears in the list.
Ten or so lines below the user lmadmin1, is the line ‘user_level
‘
To switch my lmadmin1 user from the role of Subscriber to Administrator, I have to do two things:
- Change the value from 0 to 10 on the ‘
user_level
‘ line - Replace the ‘
capabilities
‘ meta_key value text with ‘a:1:{s:13:"administrator";s:1:"1";}
‘
The moment I type or paste in the text and hit the enter key I should be able to jump back into WordPress and log in with full Administrator privileges.
It’s really that easy!