Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to populate a drop down select meta box with a list of child pages of that page.

I am using the wp_list_pages function to retrieve the list of child pages, no problem there.

The problem is that the list is return as li items. What is the best way to get these into an <option> format suitable for a dropdown box?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Not sure what you mean by "drop down select meta box", so maybe I'm way off, but there is a wp_dropdown_pages function that does that.

share|improve this answer
    
Wow thanks a lot, completely missed that, thanks. This is pretty much what I need. Yeh its a select box I want to add to a metabox on a page edit screen. Thanks again! –  Davos555 Sep 18 '12 at 11:00
add comment

Your Answer

 
discard

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.