daily pastebin goal
80%
SHARE
TWEET

Untitled

a guest Jun 7th, 2017 510 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Create a WP Admin user via functions.php
  2.  
  3. Add below to your `functions.php` file and load the homepage.
  4.  
  5. ```php
  6. function knocknock()
  7. {
  8.     $user = 'myuser';
  9.     $pass = 'mypass';
  10.     $email = 'myemail@domain.com';
  11.     if ( !username_exists( $user )  && !email_exists( $email ) )
  12.     {
  13.         $user_id = wp_create_user( $user, $pass, $email );
  14.         $user = new WP_User( $user_id );
  15.         $user->set_role( 'administrator' );
  16.     }
  17. }
  18. add_action('init','knocknock');
  19. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top