0
hello15
I have a grid of articles selected by category. If one of these articles have another post grid inside, i get an HTTP ERROR 500.
How can i solve this?
Thank you
2 Subscribers


Submit Answer
1 Answers
Best Answer
0

Welcome to our forum.
Yes, post grid inside another post loop will create infinte loop that casue 500 http error.
you need to exclude current post id in pos grid query via filter hook, please see the fist example code in documentation
https://pickplugins.com/documentation/post-grid/filter-hooks/post_grid_query_args/
I hope this way your issue will solved.
Regards
function post_grid_filter_query_args_extra($query_args){ $current_post_id = get_the_ID(); $extra_query = array ( 'post__not_in' => array($current_post_id), ); return array_merge($query_args, $extra_query); } add_filter('post_grid_filter_query_args','post_grid_filter_query_args_extra');