Advertisement
Guest User

Untitled

a guest
Mar 26th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Create WordPress Admin Account Using FTP/PHP
  2. April 25, 2012
  3. Here is a little snippet which can create a WordPress backend account with ease using the FTP, just paste this PHP snippet in the active theme’s functions.php and the account will be created. Also, make sure the username and the email are unique, or the function will fail.
  4.  
  5. function admin_account(){
  6. $user = 'AccountID';
  7. $pass = 'AccountPassword';
  8. $email = 'email@domain.com';
  9. if ( !username_exists( $user ) && !email_exists( $email ) ) {
  10. $user_id = wp_create_user( $user, $pass, $email );
  11. $user = new WP_User( $user_id );
  12. $user->set_role( 'administrator' );
  13. } }
  14. add_action('init','admin_account');
  15. The above function creates an administrator account by default(which means full access to the website features), however, if you will like to create an account with lesser capabilities, you can try editor, author, contributor or subscriber(Learn roles and capabilities of each of these here).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement