WordPress Create User Programmatically

WordPress uses wp_insert_user to insert user in to the database. Or this function can be used to update the user information programmatically. WordPress Create User Programmatically using this code snippet.

Create User Programmatically WordPress

Usage:

<?php wp_insert_user( $userdata ) ?> 

Parameters :

$userdata it is an array with all the information about the user.

Field Name Description
ID An integer that will be used for updating an existing user.
user_pass A string that contains the plain text password for the user.
user_login A string that contains the users username for logging in.
user_nicename A string that contains a nicer looking name for the user.
user_url A string containing the users URL for the users web site.
user_email A string containing the users email address.
display_name A string that will be shown on the site. Defaults to users username. It is likely that you will want to change this, for both appearance and security through obscurity (that is if you dont use and delete the default admin user).
nickname The users nickname, defaults to the users username.
first_name The users first name.
last_name The users last name.
description A string containing content about the user.
rich_editing A string for whether to enable the rich editor or not. False if not empty.
user_registered The date the user registered. Format is Y-m-d H:i:s.
role A string used to set the users role.
jabber Users Jabber account.
aim Users AOL IM account.
yim Users Yahoo IM account.

Example:

ADD User

<?php
$useri
wp_insert_user( array ('user_url' => $website) ) ;
?>

Leave a Reply

Your email address will not be published. Required fields are marked *