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 have the following code going into a meta box:

function multi_author($post, $box)
$currentAuthors = esc_attr(get_post_meta($post->ID, 'multiAuthors', true));
if ($currentAuthors) {
    $authors = explode(',', $currentAuthors);
$y = 1;
for ($x = 0; $x <= 3; $x++) {
    $output .= "Author #{$y}: " . wp_dropdown_users(array(
                'show_option_none' => '-- Select --',
                'echo' => 0,
                'name' => 'author' . $y,
                'selected' => $authors[$x],
                'who' => 'authors'
            )) . "<br/>";

echo $output;

If I place this code into a front end facing page, everything works as expected. When this code is in a meta box, the 'show_option_none' tag is ignored and everything else works as planned. Wordpress version 3.1.3 is being used. Any guesses as to why this is happening?

share|improve this question
Code is working fine in a meta box so it must be something else, post your code. – Bainternet Jun 6 '11 at 6:02
There is the whole function – Tom Jenkins Jun 7 '11 at 4:28

I edited the codex to be more clear, but it already IS clear: This option forces the value to be "-1" so NONE can be selected. So 'show_option_none' and 'selected' don't play well together. I also saw that the "selected" string (/wp-includes/user.php - line 1010) is placed directly after the value attribute without a space. Could you check your sourcecode and verify this?

share|improve this answer
That line is the same in my source as well. – Tom Jenkins Jun 7 '11 at 4:15
If this is the culprit, 'show_option_none' and 'selected' not working well together, then shouldn't this be true whether the code is public facing or only in the admin. I'm only seeing issue in the admin. I also don't see any edits to the codex in the wp_dropdown_users page. – Tom Jenkins Jun 7 '11 at 4:31

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.