I would like to display the child pages of the current page in a select menu, I.E. =>

<select><option>This is a child page</option><option>This is another child page</option></select>

Of course, the option markup would be the dynamic function; markup that says basically that we want to display the child pages of the current page wrapped in an option field for each one.

The result should be a drop-down menu that someone could select the child pages title and submit it with the form. The reason being, the child pages are tours and all I need is the title to be passed to a select field so we know that' the tour they're interested in.


This can be approached by using wp_dropdown_pages() with the child_of parameter.

global $post;
$args = array(
    'child_of'         => $post->ID
wp_dropdown_pages( $args );

The variable name will be $_GET['post_id'] or $_POST['post_id'], depending on your form settings, you can change the name by altering the name parameter. The value of the variable is the ID of the chosen page. Use get_the_title() to get it from the id in your $_GET/$_POST variable.

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.