We've a courses website where we want to filter posts/courses by the keywords present in the category and/or title. Currently when filtering, the keyword is also being searched in the post content which is what we want to exclude. Is there a way to exclude searching in the post content via a hook
or filter
in wordpress ?
Attached is the image of the search results where the first search result doesn't contain a computer word either in the title or the category but still it shows in the results.
Update
Forgot to mention that it's a custom post type job_listing
.
posts_search
hook you can use. Here's an example that searches only post titles: wordpress.stackexchange.com/questions/11822/… - you would basically copy most of theWP_Query
class and remove thepost_content LIKE
part.post title
&category
?@WebElaine