Advertisement
geminilabs

[site-reviews-forms] restrict products in dropdown to a category

Aug 31st, 2022 (edited)
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. add_filter('site-reviews-forms/builder/assigned_posts/args', function ($args) {
  2.     if ('product' === $args['post_type'] ?? 0) {
  3.         $args['tax_query'] = [[
  4.             'field' => 'slug',
  5.             'taxonomy' => 'product_cat',
  6.             'terms' => ['red-products'], // change as needed
  7.         ]];
  8.     }
  9.     return $args;
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement