Created
July 19, 2012 10:37
-
-
Save stuartduff/3142942 to your computer and use it in GitHub Desktop.
WordPress remove sub pages of a parent page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$child_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent = 134 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='); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment