I love the Relevanssi plugin for WordPress. It’s an easy way to power up the, frankly lame, native WordPress search.
By default the plugin will return no search results if no search term is given. Makes sense. But what if you are searching by other criteria too, and want to allow the search term input to be empty?
I’m building a custom job search for a client. There will be a ‘Search jobs’ form in the sidebar and the user will be able to search by term and region. The region is a taxonomy which the user selects from a drop-down. The form looks like this:
You have to tell Relevanssi to listen for the region query. Here’s how:
That works great if you enter a search term and a region. Yay! But it still doesn’t allow an empty search term. With some help from Mikko, the plugin author, I got it working. Here’s the code to fix it (and the actual form code I used):
HTH,
Keith
Leave a Reply