WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can we give role parameter the value of pending in wp_insert_user ?

share|improve this question
This'll assign a custom role pending. – amit Aug 10 '12 at 7:37
mean do i have to use add_role first ?? and if i have to then can you please tell me that i don't want to give any capability should i just leave the third parameter of add_role empty or anything else? – PhpSeeker Aug 10 '12 at 7:49
yes, make a role called pending without third parameter $capabilities. and while using wp_insert_user() pass role as pending. – amit Aug 10 '12 at 8:21
up vote 1 down vote accepted

You cannot set a value as pending ( left the role parameter blank ) to not enter a user role value into database using function - wp_insert_user().

See - wp-includes/user.php # L1363


wp_insert_user() function sets a default role if you do not provide any role parameter, So if you want to register a user without any capabilities, I think there's only way is register a new role called pending without capabilities and use it while calling wp_insert_user() functions.

share|improve this answer
Thanks mate it helped me alot – PhpSeeker Aug 10 '12 at 9:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.