wp_insert_user


wp_insert_user ( $userdata )

Parameters:
  • (array|object|WP_User) $userdata { An array, object, or WP_User object of user data arguments.
Returns:
  • (int|WP_Error) The newly created user's ID or a WP_Error object if the user could not be created.
Defined at:
Change Log:
  • 3: .
  • 4: .

Description

Insert a user into the database.

Most of the $userdata array fields have filters associated with the values. Exceptions are 'ID', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 'user_registered', and 'role'. The filters have the prefix 'pre_user_' followed by the field name. An example using 'description' would have the filter called, 'pre_user_description' that can be hooked into.

Related Functions

wp_insert_term, wp_insert_site, wp_insert_post, wp_insert_category, wp_set_current_user

Top Google Results

User discussions

wpseek mobile