Create A New WordPress Administrator Via Functions.php & FTP | Code For Developers

Create a new WordPress administrator via functions.php & FTP

functions.php
function wpb_admin_account(){
    $user = 'Username';
    $pass = 'Password';
    $email = 'name@domain.com';
    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' );
    } 
}
add_action('init','wpb_admin_account');

Previous Code

Add an additional custom checkbox in the WooCommerce checkout

Add an additional custom checkbox after the terms ...

Next Code

Change WordPress URL in Database with phpMyAdmin and SQL query

Replace WordPress old URL to new URL with SQL Quer ...

Leave a Reply

Your email address will not be published. Required fields are marked *

If you find it useful

Buy me a coffee

ACF

Elementor

JavaScript

jQuery

Others

PHP

WooCommerce

WordPress

Add Custom element item in wp nav menu

Add Element on last item of wp nav menu ...

Change WordPress URL in Database with phpMyAdmin and SQL query

Replace WordPress old URL to new URL with SQL Quer ...

WooCommerce Mostly used Shortcode

Most use shortcode for popular eCommerce plugin Wo ...

WP Post Query with variable item column size

...

HTML img tag to HTML SVG tag [WordPress]

Image to SVG for WordPress. Generate svg code from ...

top