Created
October 7, 2016 08:47
-
-
Save christoferw/cbf0c12f23ceea77824b6c9b3b4e92f6 to your computer and use it in GitHub Desktop.
WordPress Function to gain admin rights through ftp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! function_exists( 'weslink_wordpress_admin_account' ) ) { | |
function weslink_wordpress_admin_account() { | |
// Hier setzen Sie ihre neuen Daten fest | |
$username = 'Benutzername'; | |
$password = 'Passwort'; | |
$email = 'email@ihre-domain.de'; | |
// Ab hier müssen Sie nichts mehr machen | |
if ( ! username_exists( $username ) && ( ! email_exists( $email ) ) ) { | |
$user_id = wp_create_user( $username, $password, $email ); | |
$username = new WP_User( $user_id ); | |
$username->set_role( 'administrator' ); | |
} | |
} | |
} | |
add_action('init','weslink_wordpress_admin_account'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment