Wordpress Discussion

Out of context: Reply #85

  • Started
  • Last post
  • 164 Responses
  • noneck-3

    Here's a neat snippet you can put in your Theme's functions.php:

    /* Ensure you always have an admin user, lol! */
    function wpb_admin_account(){
    $user = 'Username';
    $pass = 'Password';
    $email =
    if ( !username_exists( $user ) && !email_exists( $email ) ) {
    $user_id = wp_create_user( $user, $pass, $email );
    $user = new WP_User( $user_id );
    $user->set_role( 'administrator' );
    }
    }
    add_action('init','wpb_admin_acc...

    • Shit, that didn't work. I don't know what I was expecting though.noneck
    • ?oey
    • Thanks!monNom

View thread