0

I want to create a drop down in my WordPress admin containing all posts, pages and custom post types. The return value should be a link to that page or an ID of the page.

Is there something build in for this, or is there an easy way to do it? Thanks in forward.

  • 1
  • If the answer was helpful to you, then consider accepting it. See »What should I do when someone answers my question?« and/or »Why is voting important?«, more information about the WordPress Development model is available at the help center. – Nicolai Nov 9 '15 at 12:13
  • @ialocin And if the answer was not helpful I can't blame him for trying to help me, but I also can't vote up. In the document you send me there stands I also should not thank him (Please do not add a comment on your question or on an answer to say "Thank you"), so I did nothing. Thanks for blaming though ;) – ronnyrr Nov 10 '15 at 8:59
  • Sorry, if you feel I'm blaming you, that wasn't the intention. I'm just taking care of old business, meaning, I checked up on old(er) question yesterday. Aside from that, you are free to do whatever you want. For the future, if you need more information or are not entirely happy with an answer, just say it. A polite comment like »Thanks, but I really wanted to know../my question actually was about..« or something similar, goes a long way in my experience. – Nicolai Nov 10 '15 at 9:12
1

There is nothing build-in to create the drop-down for you, so you have to do it yourself. To get the needed information you can use get_post_types() to get the post types you want, set the $args parameter accordingly.
Additionally you can set the $ouput parameter to objects, if you need the data provided - it defaults to names and then you will just get those. Take a look at the get_post_type_object() to see how the returned objects are structured.
As for the dropdown, as I said, you have to build it yourself - this really isn't WordPress specific, but a really simple PHP task. For the dropdown you'll need the links to the different post type edit screens. They generally look like this: http://site.ext/wp-admin/edit.php?post_type=posttypename If you're not sure how to build it, then perform a internet search, because how to construct a dropdown has certainly been the topic somewhere already.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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