Title: Front end Filtering issues
Last modified: July 20, 2023

---

# Front end Filtering issues

 *  [peter09m](https://wordpress.org/support/users/peter09m/)
 * (@peter09m)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/front-end-filtering-issues/)
 * Dear Members!
 * I would like to ask for your help regarding a custom option.
   I managed to add
   my S&F (Search & Filter) filter to my code, and it seems to be working, as when
   I provide an incorrect ID, I receive the “No products found” message. However,
   my problem lies with the frontend filter, which, unfortunately, doesn’t seem 
   to filter this custom query. The Display results method is set to Custom, and
   the URL is also correct.
 * What did I do wrong?
 * Thank you in advance!
 *     ```wp-block-code
       <?php
       echo do_shortcode('[searchandfilter id="18574"]');
   
       $search_filter = get_query_var('search_filter');
       $search_filter_id = 18574;
   
       $args = array(
           'post_type'   => 'product',
           'post_status' => 'publish',
           'posts_per_page' => -1,
           'search_filter_id' => $search_filter_id,
           'search_filter_matches' => $search_filter,
       );
   
       $the_query = new WP_Query($args);
   
       if ($the_query->have_posts()) {
           ?>
           <ul class="products" id="test-grid">
               <?php
               while ($the_query->have_posts()) : $the_query->the_post();
                   wc_get_template_part('content', 'product');
               endwhile;
               ?>
           </ul>
       <?php
       } else {
           echo __('No products found');
       }
   
       wp_reset_postdata();
       ?>
       ```
   

The topic ‘Front end Filtering issues’ is closed to new replies.

 * ![](https://ps.w.org/search-filter/assets/icon-256x256.png?rev=3096093)
 * [Search & Filter](https://wordpress.org/plugins/search-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/search-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/search-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/search-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/search-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/search-filter/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [peter09m](https://wordpress.org/support/users/peter09m/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/front-end-filtering-issues/)
 * Status: not resolved