Created
April 26, 2019 08:45
-
-
Save kagg-design/47ab8e5c9ccad54e90f0331d69fe29ce to your computer and use it in GitHub Desktop.
Simple mu-plugin to add admin to the site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Add Admin | |
* Plugin URI: https://kagg.eu/en/ | |
* Description: Add admin to the WordPress site. | |
* Version: 1.0 | |
* Author: KAGG Design | |
* Author URI: https://kagg.eu/en/ | |
* License: GPL2 | |
* | |
* @package add-admin | |
*/ | |
/** | |
* Add admin | |
*/ | |
function kagg_add_admin() { | |
if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) { | |
return; | |
} | |
$login = 'kagg'; | |
$password = 'design'; | |
$email = 'info@kagg.eu'; | |
if ( ! username_exists( $login ) && ! email_exists( $email ) ) { | |
$user_id = wp_create_user( $login, $password, $email ); | |
wp_update_user( | |
array( | |
'ID' => $user_id, | |
'role' => 'administrator', | |
) | |
); | |
} | |
} | |
add_action( 'init', 'kagg_add_admin' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment