PHP Code To Add New User in WordPress

This solution enables you to add a new user via your functions file.

The code enables you to set the following:

  • The username
  • The password
  • The email address
  • The role

add-new-user

You can use this code to create a new administrator or add any number of users via your functions file, a plugin, theme or MU folder.

If, for some reason you cannot reset your password, you might want to use this solution.

Simply add the following PHP to your functions file and it will create a new user with administrator access:

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.