• Resolved Bevrob

    (@bevrob)


    Hi , I like the GeeSearch plugin, but my site shows posts as
    products, an ecommerce site. I want to stop Geesearch from returning
    pages, like ‘contact us’ or ‘home’ as they mess up my product grids.
    I had this overcome with the regular WP-search by adding to the
    function.php file the following , but your script now ignores this,

    ‘function SearchFilter($query) {
    if ($query->is_search) {
    $query->set(‘post_type’,’product’);
    }
    return $query;
    }
    add_filter(‘pre_get_posts’,’SearchFilter’);’

    thank you

    https://www.ads-software.com/plugins/gsearch-plus/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Luis Godinho

    (@luistinygod)

    Hi Bevrob

    Change your last line of code and set the priority to 100, like this:
    add_filter('pre_get_posts','SearchFilter', 100);

    I’ll take your feedback into account for the next release, where I’ll add some hooks to define the post_type’s.

    Let me know how it goes.

    Cheers
    Luis

    Thread Starter Bevrob

    (@bevrob)

    Hi Luis,
    I forgot to come back and tell you that suggestion worked very well,
    thank you,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Eliminating pages from search results’ is closed to new replies.