How to exclude the word “class” from being matched in search?
You might try to use the posts_search filter as elegantly suggested by @Kaiser in the first link you provided. Here is one idea: function filter_search($sql){ global $wpdb; if( strpos(get_query_var(“s”),”lass”) !== false AND strpos(get_query_var(“s”),”class”) === false ){ $sql .= ” AND {$wpdb->posts}.post_title NOT LIKE ‘%class%'”; $sql .= ” AND {$wpdb->posts}.post_content NOT LIKE ‘%class%'”; } return $sql; … Read more