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?

0

try this

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

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.