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

How to make in the admin's dashboard a <select> with the list of all posts of specified post type?

I need this in order to save a post ID with set_option() call.

How to do this?

share|improve this question
up vote 1 down vote accepted

Use wp_dropdown_pages() to create the drop down. It accepts an post_type parameter.

To avoid collisions with plugins filtering this function you may use walk_page_dropdown_tree() and build your own select. See this post for a code example.

share|improve this answer
It does not work because get_posts(array('post_type'=>'department')) returns nothing (despite of the fact that a post of the type 'department' exists. – porton Apr 10 '12 at 20:23

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.