How To Manually Add User in WordPress

Posted: April 19th, 2017

Topics: Wordpress

I recently dealt with a pretty unfortunate situation in which I needed to do a website handoff with the former developer of one of my clients. I’ve done this before with no issue, but this development group in particular was extremely withholding of crucial levels of access I needed to do this simply — commonly known as “holding a site hostage.”

Once I was able to get the site migrated from a zipped file package, I was stuck with the users they had created, which they wouldn’t give me access to. So, I had to figure out a way to do this manually, by way of MySQL. This is done in PHPMyAdmin, so you’ll need to have your site files migrated to your own server to do this (or at least have server access).


  • Navigate to your cPanel
  • Under the Databases heading, find “PHPMyAdmin” — click on it
  • Select the database you wish to edit. After it loads, click on the menu item that says “SQL”
  • There, you will see an editor in which you can add your SQL code. You will ad this & click “Go”
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('testadmin', MD5('testpass'), 'first last', '', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

Please note: Replace the following fields in the code with your own desired credentials: testadmin, testpass, first last,

Unless you get any error messages, you should be able to log into your site with the newly set credentials.

One common issue I found:

  • This code happens to assume you are using the standard WP database prefix, which is “WP” — If you are not using this you will have to amend your code to reflect the proper titles of wpusers and wpusermeta