×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Eric De Kock
Added: Feb 22, 2017 7:16 PM
Views: 15
Tags: no tags
  1. function wpb_admin_account(){
  2. $user = 'Username';
  3. $pass = 'Password';
  4. $email = 'email@domain.com';
  5. if ( !username_exists( $user )  && !email_exists( $email ) ) {
  6. $user_id = wp_create_user( $user, $pass, $email );
  7. $user = new WP_User( $user_id );
  8. $user->set_role( 'administrator' );
  9. } }
  10. add_action('init','wpb_admin_account');