Skip to content

Instantly share code, notes, and snippets.

@Nikschavan
Last active September 19, 2016 12:46
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 Nikschavan/989bbad04761ca90e2db7fa6d35f9e12 to your computer and use it in GitHub Desktop.
Save Nikschavan/989bbad04761ca90e2db7fa6d35f9e12 to your computer and use it in GitHub Desktop.
Add this file in `wp-content/mu-plugins/user.php` and just reload the site, a new user will be created with username and password used in the script below.
<?php
add_action( 'init', 'add_new_user' );
function add_new_user() {
$website = "http://example.com";
$userdata = array(
'user_login' => 'user_name',
'user_url' => $website,
'user_pass' => 'user_password',
'role' => 'administrator'
);
$user_id = wp_insert_user( $userdata ) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment