Ever locked yourself out of your WordPress installation? No, of course not – you always keep a secure copy of your passwords. But I had a situation last week where I needed to perform admin actions on a copy of a client’s site and only had non-administrative access.
I’d recommend strongly against hacking yourself an admin account on a client’s actual site – if you need admin access and they haven’t given it to you then ask them for admin access and explain why it’s necessary. Hacking your clients doesn’t always go down well. But if they’ve already given you a full site backup then you’re not going to break anything and it’s pretty clear they trust you, so go ahead and hack your local copy.
Of course you might also need to do this in the unlikely event that you DO forget your administrative password or you’re hacked and your administrative user is deleted.
There’s several how-to guides on the net that lay out the three minimum steps:
- add yourself a user ID in the wp_users table
- add a wp_capabilities entry for that user in the wp_usermeta table
- add a wp_user_level entry for that user in the wp_usermeta table
but one thing I noticed they all failed to emphasize & initially tripped me up when I did this myself, was the table names…
Continue reading Adding an Admin User to Your WordPress Database