Show child posts only

Forums › Forums › Search & Filter Pro › Show child posts only

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #183004

    Awesome plugin!

    Is it possible to show only child posts on the search results page? In other words, I want to exclude parents. (I’m trying to simulate this WP query.)

        'post_parent__not_in' => array(0)
    

    Thank you.

    Trevor
    #183013

    You can achieve this b7y using our Edit Query Arguments filter:

    https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments

    Anonymous
    #183103

    Thank you! Here’s what worked for me, in case anyone needs it:

    function filter_function_name( $query_args, $sfid ) {
      
      if($sfid==22)
      { 
        $query_args['post_parent__not_in'] = array(0);
      }
      
      return $query_args;
    }
    add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );
    Trevor
    #183110

    Thank you for sharing.

Viewing 4 posts – 1 through 4 (of 4 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.