For example, I'm using wp_list_pages to display the navigation, the child pages (and their children) appearing on hover as is typical. However, I want one of these parents to not display the children. Essentially I want something like exclude_children_of to work in the wp_list_pages arguments; is there a way of doing this anybody?



1 Answer 1


try -:

if your page ID = 999

$child_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent = 999  AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.ID ASC");
$exclude = implode($child_ids,', ');
wp_list_pages('exclude=' . $exclude . '&title_li=<h2>' . __('Pages') . '</h2>');
  • you are most welcome.
    – krembo99
    May 30, 2012 at 13:19

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.