Results 1 to 1 of 1

Thread: How to Exclude Categories in Search

  1. #1
    Thread Starter
    Amateur
    Not a Verified Customer
    Charles43's Avatar
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Exclude Categories in Search

    How do I go about excluding categories in search. I tried adding just about every type of code other webmasters told me to for the function.php file and also tried every plugin.

    There must be some code I have to alter in the functions, I tried removing 'name' from function but it's still searching.

    I think this is the code I have to alter, I would appreciate help for this, I have a blog connected to my classipress site and it's picking up my blog posts.

    function custom_search_where($where) {
    $old_where = $where;
    if (is_search() && isset($_GET['s'])) {
    global $wpdb;
    $customs = Array('name', 'price', 'phone', 'location');
    $query = '';
    $var_q = stripslashes($_GET['s']);
    if ($_GET['sentence']) {
    $search_terms = array($var_q);
    }
    else {
    preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $var_q, $matches);
    $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to exclude pages from search form results
    By rtibbs4 in forum ClassiPress General Discussion
    Replies: 3
    Last Post: August 22nd, 2009, 05:07 PM