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

I am new to wordpress and currently making a plugin.

I am getting list of authors using

<?php wp_dropdown_users(array('name' => 'author'));?>

Now when submitting my form I want to retain the current value entered by the user but as soon I submit the form the values get back to the default ones.

I have searched on net and tryed alot but somehow not able to do this task.

share|improve this question

migrated from webmasters.stackexchange.com Oct 17 '13 at 7:36

This question came from our site for pro webmasters.

up vote 2 down vote accepted

Reviewing wp_dropdown_users() there is apparently a 'selected' parameter. So in theory, you could probably pass the posted value in here.

// set to the posted value, but you might be able to do this differently, depending on how you are storing the data
$selected = isset($_POST['author']) ? $_POST['author'] : false;

$args = array( 'name' => 'author',
               'selected' => $selected );

wp_dropdown_user( $args );
share|improve this answer
It was helpful.. – pd4627 Oct 17 '13 at 10:41
If it was the answer, then please accept it as the answer so we can close this question. – helgatheviking Oct 17 '13 at 10:55

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.