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]);