Checking if looped item has a parent inside a shortcode
Question
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()) {
$q->the_post();
... <- Check if the loop item has a parent
}
wp_reset_postdata();
0
2 months
0 Answers
10 views
0
Leave an answer
You must login or register to add a new answer .