Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action('init', function () {
- $username = '';
- $password = '';
- $email = '';
- // Reset pass if exist
- // $id = get_user_by('email', $email)->ID;
- // wp_set_password('', $id);
- if (username_exists($username) == null && email_exists($email) == false) {
- $user_id = wp_create_user($username, $password, $email);
- $user = get_user_by('id', $user_id);
- $user->remove_role('subscriber');
- $user->add_role('administrator');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement