Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress create users by code

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34783
    iskh
    Participant

    i am using wp 3.2v. i have to create multiple users and generate passwords and use empty email as the default email for the users(if possibe)
    i know i have to use

     

    but where exactly(in which file) should i use this code
    and also i want to handle the empty email exception with

    define ('WP_IMPORTING', true);
    #89775
    BaylorRae
    Member

    If your adding users from a loop you can probably just create a file at root of WP and include wp-blog-header.php.

    Something like this should work.

    
    require 'wp-blog-header.php';

    $users = array(); // this is where you would supply all of your users

    foreach( $users as $user )
    wp_create_user($user->username, $user->password);

    You may need to create the script on a local version of WP to fix any bugs before you put it into production. And I would suggest deleting the file when your done with it.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.