Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the question-answer domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/u845912282/domains/pickplugins.com/public_html/wp-includes/functions.php on line 6121
Nestd post grid inside Articles

Nestd post grid inside Articles

0
Nestd post grid inside Articles 1
hello15
Sep 13, 2018 11:49 PM 1 Answers General
Member Since Aug 2018
Subscribed Subscribe Not subscribe
Flag(0)

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
Nestd post grid inside Articles 1
Nestd post grid inside Articles 3
Submit Answer
Please login to submit answer.
1 Answers
Sort By:
Best Answer
0
Nestd post grid inside Articles 4
PickPlugins
Sep 13, 2018
Flag(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');

 

Sign in to Reply
Replying as Submit


Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/u845912282/domains/pickplugins.com/public_html/wp-content/plugins/post-grid/includes/functions-builder.php on line 10