geminilabs

Untitled

Feb 10th, 2026
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. add_filter('site-reviews-filters/config/forms/filters-form', function (array $config): array
  2. {
  3.     $plant_based_challenge_page_slug = 'plant-based-challenge';
  4.     $plant_based_challenge_term_ids = [10355, 10356, 10373];
  5.  
  6.     if (empty($config['filter_by_term']['options'])) {
  7.         return $config;
  8.     }
  9.     if ($plant_based_challenge_page_slug !== get_queried_object()?->post_name) {
  10.         return $config;
  11.     }
  12.     $options = $config['filter_by_term']['options'];
  13.     $config['filter_by_term']['options'] = array_filter(
  14.         $options,
  15.         static fn ($id) => in_array($id, ['', ...$plant_based_challenge_term_ids]),
  16.         ARRAY_FILTER_USE_KEY
  17.     );
  18.  
  19.     return $config;
  20. }, 15);
Advertisement
Add Comment
Please, Sign In to add comment