I have a custom meta box with a dropdown displaying all the WP users via wp_dropdown_users. It saves which WP user is chosen with the post, so that all works.

However, is there a way to make it show the selected user in the dropdown when going back to edit, rather than the first in the list? I've used the selected() function for another dropdown but I've created that dynamically. I've tried to implement selected() with wp_dropdown_users, but it hasn't worked so I'm not sure if it's even possible?


1 Answer 1


You need to set selected argument for the wp_dropdown_users function. Do it like this:

wp_dropdown_users( array( 
    // ...
    'selected' => $user_id,
    // ...
) );

Read documentation for wp_dropdown_users function

  • Thank you! I thought it was that at first but I thought it required an actual ID number. End of semester, brain not working right. Thanks again! Apr 14, 2012 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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