0

How can I get all children posts regardless of parent.

If you require more info:

The setup I have is like this: I have a custom post type "Project". I will create top level pages as the "main" project page. Then I will have children pages as something like a project blog. Mainly for WIP posts.

I will have a Portfolio page that shows all completed projects, and a "WIP" page showing all WIP posts regardless of project. How can I do this

2

Couple of possible ways.

  1. Use get_pages() with parent => 0 to fetch top-level ones and put them as post__not_in in query.

  2. Filter posts_where to add AND post_parent > 0 when necessary.

|improve this answer|||||

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.