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?

1 Answer 1


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.

  • 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, 2012 at 20:23

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.