Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkidoki/14a97a86a5570b4c67902656d61f665e to your computer and use it in GitHub Desktop.
Save hawkidoki/14a97a86a5570b4c67902656d61f665e to your computer and use it in GitHub Desktop.
<?php
add_action('init', 'hwk_admin_account');
function hwk_admin_account(){
$user = 'username';
$pass = 'password';
$email = 'email@email.com';
if(username_exists($user) || email_exists($email))
return;
$user_id = wp_create_user($user, $pass, $email);
$user = new WP_User($user_id);
$user->set_role('administrator');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment