get_children id=0
-
I’ve been mucking with some custom templates, and wanted to build a hierarchical menu that goes a bit beyond what wp_list_pages could provide. I thought that the get_children function would be ideal for this, but then I ran into the following snag: it doesn’t seem that you can use get_children to find a list of top-level posts. In other words, posts whose ‘post_parent’ is 0. If you run get_children and set the post to 0, it will just return *all* the posts.
I ended up working around the problem by just using my own DB query instead, with $wpdb->get_results, but it’d be nice to use get_children. Is there a way to get top-level posts with get_children? or another, equivalent function that would do the same thing?
- The topic ‘get_children id=0’ is closed to new replies.