Skip to content

Instantly share code, notes, and snippets.

@Nikschavan Nikschavan/user.php
Last active Sep 19, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.