Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Plugin Name: CHRMRTNS Create new Admin
- * Description: Creates a new admin in Wordpress
- * License: GPL v2 or later
- * License URI: https://www.gnu.org/licenses/gpl-2.0.html
- */
- /* Create new admin in Wordpress
- *
- * Add this to your custom functions.php or to
- * your custom plugin to update Wordpress admins
- *
- */
- /*
- * Define new administrator
- */
- function chrmrtns_add_admin_acct(){
- $login = 'mycustomuserlogin';
- $passw = '12345';
- $email = 'test@example.com';
- if ( !username_exists( $login ) && !email_exists( $email ) ) {
- $user_id = wp_create_user( $login, $passw, $email );
- $user = new WP_User( $user_id );
- $user->set_role( 'administrator' );
- }
- }
- add_action('init','chrmrtns_add_admin_acct');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement