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?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityHow 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?
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.