Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Exclude categories – documentation?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Marion Golin
    #5384

    Hi,

    I see references in the forums to the ability to exclude categories from search. I can’t seem to find and reference in the documentation for this feature. I apologize in advance if I just missed it. I would also like to add my support for the “include” categories option that has been mentioned in the forums as well.

    Thanks!

    Ross Moderator
    #5389

    Hey Marlon

    It was never implemented actually – there were several workounds but those no longer work.

    Fortunately for you, I’ve just updated the plugin (v1.2.5) which has a settings panel where you can do this 🙂

    Please check for updates and you should have what you need.

    Thanks
    Ross

    Marion Golin
    #5391

    Thanks! I was able to use this snippet of code to achieve the result I needed which I also found in the forums.

    function filter_results( $query )
    {
    global $sf_form_data;
    global $wp_query;

    if ( $sf_form_data->is_valid_form() && $query->is_main_query() && !is_admin() )
    {
    $query->set(‘cat’, ‘-1,-2,-3’); //you can use any query modifications from here – http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
    }
    }
    add_action( ‘pre_get_posts’, ‘filter_results’, 21 );

    Ross Moderator
    #5399

    Hey Marion.that’s good news but I advise to switch over to the new way when you can to ensure future compatibility 🙂

    Give me a shout if you have any problems

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.