0

I have below structure in wp post (custom post type):

POST

Child1

Child11 (*)

Child12 (*)

Child2

Child21 (*)

Child22 (*)

Child3

I need to get starred posts by wp_query class (or hooks)

Note: I sure that maximum depth of posts is two.

How do i do this?

1 Answer 1

0

try this

$posts = get_posts([
    "post_type" => "ABCD", // put the custom type here
    "post_parent__not_in" => "0", // parent is not root
]);
2
  • May you please explain how this code helps solve the question? Oct 20, 2016 at 2:16
  • I already wrote this code. but wp_query return (Child1, Child2 & Child3) and childs (starred) posts
    – MahdiY
    Oct 20, 2016 at 8:21

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.