Skip to content

Instantly share code, notes, and snippets.

@christoferw
Created October 7, 2016 08:47
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 christoferw/cbf0c12f23ceea77824b6c9b3b4e92f6 to your computer and use it in GitHub Desktop.
Save christoferw/cbf0c12f23ceea77824b6c9b3b4e92f6 to your computer and use it in GitHub Desktop.
WordPress Function to gain admin rights through ftp
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