Checking if looped item has a parent inside a shortcode


all I want is to check if the custom post item in the loop has a parent. I am using this inside a shortcode. I could not find how to access the property from inside the loop.

Thank you my dears

$q = new WP_Query(array(
    'post_type' => 'my_custom_post_type',

    'posts_per_page' => 5,
    'category' => '',

while ($q->have_posts()) {
      ... <- Check if the loop item has a parent
El Gringo 2 months 0 Answers 10 views 0

Leave an answer