- This topic has 0 replies, 1 voice, and was last updated 9 years, 9 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › General Stuff › Instructions/F.A.Q › Lost Admin Privileges – Getting WordPress Admin Access Back
Tagged: access, admin, administrative privileges, permission, restore admin
It is very easy to get the WordPress admin access back (if you have lost it somehow).
You just need to update a value in the “wp_usermeta” table of your WordPress database.
The following image should explain what value needs to be updated in the “wp_usermeta” database table (you can update the database value by going to cPanel->PHPMyAdmin of your website):
http://images.tipsandtricks-hq.com/forum-images/user_meta.JPG
If you look at the wp_usermeta table you can see that there is a column “wp_capabilities” for the User ID “1” (this is the admin users id in my case).
Now look at the value of this “wp_capabilities” column and put the same in yours and it should give you admin access back.
1. open the “wp_usermeta” table and find the “wp_capabilities” entry for the admin user (the user ID will allow you to verify). Now edit the value for the correct “wp_capabilities” row and update it’s value with the following:
a:1:{s:13:"administrator";s:1:"1";}
That should do it.
You can use the following PHP code to create a user with admin access.
$user = new WP_User('','myusername');
$user->set_role('administrator');
Change “myusername” to the username you want to use.
Log in to your site via FTP and add the above code to your theme’s functions.php file. Then load any page on the site. It will run the code and create the account with admin privileges. Make sure to remove the code after you’re done (this is very important). After that, you can login as that user and reset everything.