Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a few search filters set up and I found a few posts that shouldn't be in the search results. On looking into it further I found these posts match 'part' of the keyword.

For example, searching for 'car' would match posts with 'carried', 'carbon', 'scar' and anything else with car in the word. I really want this to only pull posts that match 'car' exactly.

Is this how wordpress works by default? I've already tried the 'exact' => true argument on WP_Query but that makes the search horribly specific when using category filters etc.

How can I set it so it matches keywords exactly?

share|improve this question
add comment

1 Answer

You might want to append the query parameter sentence=1 in your search, it is not well documented, but it should retrieve content inside the post that matches exactly the sentence pattern.

Alternatively, for a more powerful search, you might want to give a look at Relevanssi plugin. A lot of people agree that Wordpress search engine is… lacking, to say the least.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.