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)