Skip to content

Instantly share code, notes, and snippets.

@YuvrajKhavad
Last active June 19, 2022 05:00
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save YuvrajKhavad/a7c56d094d96b4e642e65464c69c418f to your computer and use it in GitHub Desktop.
Register new WordPress user using FTP or File Manager. Add this code in your function.php file of active theme.
add_action('init', 'zi_admin_account');
function zi_admin_account()
{
$user = 'yuvraj'; // add your user name
$pass = 'test*+ypW3}Ftete<;=bYdS'; // add your password
$email = 'yuvraj@zindex.co.in'; // add your email address
if (!username_exists($user) && !email_exists($email))
{
$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