Support » Themes and Templates » exclude from search

  • kortschot


    Hé there,

    Got a little PHP question..

    I want to exclude a category from my search results. But can’t do it by ID.

    function myFunctionName($query)
    if ($query->is_search)
    $query->set('cat','-'.$get_cat_id('category name').'');
    return $query;

    I’m not a php wizard.. but i’m guessing the snag is in:

    $query->set('cat','-'.$get_cat_id('category name').'');

    I tried


    Which works, but since I have some more installations of the same theme coming in the next month’s I want it to work on the category name instead of the ID. Due the ID won’t be the same in every installation and the name will.



  • The topic ‘exclude from search’ is closed to new replies.