New Landing How can we help? Atelier Search problems

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Atelier
  • #254438
    le_hee
    Member
    Post count: 2

    Hi there!
    I need your help with a problem I encounter when using the theme’s search.

    http://www.beaumontandfletcher.com/?post_type=product&s=chair

    All searches are showing more results than they should, and as the site is live my client is very frustrated.

    I would appreciate a quick help.

    Regards,

    Lehel

    #254905
    David Martin – Support
    Moderator
    Post count: 20834

    Hi Lehel,

    This is the default WP search function – the theme does not control this. When you say returning more results then it should are you refering to search terms that are not an exact match for the term chair?

    Thanks.

    #254906
    le_hee
    Member
    Post count: 2

    Hi David,

    I mean if you check out the link I sent you will see the search provides results that don’t have anything to do with the searched term.

    Any idea how to fix this?

    #254910
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    Sure I visited the link, you would need to look into using a WP search plugin/hire a developer to help refine your results as there is not a theme related function that is causing the broad search.

    Thanks.

    #292253
    Ian
    Member
    Post count: 121

    le_he

    Here is a code snippet that you can modify and it may help you with your problem. I was having a similar problem that was made even worse by some extra custom post types I am using.

    Include only the post types in the array that you want searched, everything else will be ignored.

    You can add this to your functions.php file if you are using a child theme or I use a plugin called “Code Snippets” that makes managing snippets super easy.

    
    function filter_search($query) {
        if ($query->is_search) {
        $query->set('post_type', array('product','page', 'herb', 'recipe', 'post'));
        };
        return $query;
    };
    add_filter('pre_get_posts', 'filter_search');
    

    Hope this helps!

    -Ian

    #292322
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Thanks Ian, appreciate you taking the time to post that.

    – Ed

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register