I'm working on a wordrpess site for improve search result. Now I want to fetch posts from a certain category & all child pages from one parent page.

If I set

post_parent => parent_id

then it only show all child pages, and not any posts(blog post). But I want to show child pages from given id && blog posts. like:

post_parent=>parent_id && post_type=>post&&category=>array(cats id).

Any suggestions on how to accomplish this

  • By & there do you mean you actually want two sets of post for two different conditions in one query? It doesn't work like that.
    – Rarst
    Commented Jun 11, 2014 at 17:52
  • Yes, actual, I want to show some blog post from certain category & some child pages using parent page id but not all.
    – Meathanjay
    Commented Jun 11, 2014 at 21:01
  • Your question doesn't make much sense. As @Rarst said, you cannot do it in one query, wordpress doesn't work that way. You will have to run two queries. If you are not sure, file an edit and be more clear on what you actually need. Show some example, and the code that you have tried and why it is not working. Commented Jun 12, 2014 at 5:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.