How to filter WordPress search results by category

24 July 2019

This post could just as easily be called 'how to filter a WordPress category page by keyword search term'!

Anyway here is a standard WordPress search page URL (in this case for the keyword 'count'). It shows results from all categories:

And here is a WordPress category page URL (for the category 'web development'). It shows all posts in that category:

It is possible to combine the two. So the following URL only shows posts within the 'web development' category that also include the word 'count':

It is also possible to use the category ID in the URL instead and get the same results:

I recently used this technique on a client's classifieds website to generate quite specific browse pages in lieu of having a complex taxonomy.

Notify of
Inline Feedbacks
View all comments
James Clark
Hi! I'm James Clark and this is my website. I publish all my guides completely free, so if you find them useful then please:
What do you think? Leave a commentx
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram