Continue reading Ordering search results by date

Ordering search results by date

I’m building a directory and would like the oldest posts to automatically display first in the search results, is this possible? I found out how to add a link that the user can click to sort the results but would like an automatic solution. Can you provide code that can be added to the functions.php…

Read more Ordering search results by date 3 Comments on Ordering search results by date
Continue reading Using multiple custom taxonomies

Using multiple custom taxonomies

Usually, WordPress supports one category, one tag and one taxonomy in the search, if you use the query variables to set the taxonomies. You can enter multiple taxonomies as parameters to the query, but only the first one is used. If you want to have multiple taxonomies involved, you need……to build a tax_query. The correct format is described in the Codex. Of course, you can’t just pass the array in a query variable, so you’ll have to build it. Here’s how you do a two-taxonomy search. Search form First, we need to add the inputs to the search form….…in the search form code: wp_dropdown_categories( array( ‘name’ => ‘movie_director’, ‘taxonomy’ => ‘director’ ) ); wp_dropdown_categories( array( ‘name’ => ‘movie_actor’, ‘taxonomy’ => ‘actor’ ) ); Introducing the query variables WordPress cleans out unknown query variables for data hygiene reasons. That’s a good thing, but a bit of a complication for…

Read more Using multiple custom taxonomies 60 Comments on Using multiple custom taxonomies
Continue reading Search results in random order

Search results in random order

…the first page on it, and some posts may never appear in results. Here’s a more complicated solution that solves the issue by setting the random number generator seed every hour. Searches within that hour will return the results in the same order. This means pagination will work (unless the…

Read more Search results in random order 1 Comment on Search results in random order
Continue reading Adjusting search throttle

Adjusting search throttle

If Relevanssi Premium causes out-of-memory problems, make sure you have the “Throttle searches” option checked. However, if that doesn’t work and you’re still getting out of memory issues, you can try making the throttle tighter. The limit can be adjusted by adding this line to your site: If necessary, you can adjust the value (250)…

Read more Adjusting search throttle 7 Comments on Adjusting search throttle
Continue reading Most important Relevanssi debugging trick

Most important Relevanssi debugging trick

When you have problems with Relevanssi, these are the first steps to take: Make sure you have the latest version of Relevanssi. If not, upgrade. Try deactivating the plugin and reactivating it. Are you using Yoast Local SEO? Read this. Try deleting the plugin and reinstalling it from scratch. If that doesn’t help, then approximately…

Read more Most important Relevanssi debugging trick 271 Comments on Most important Relevanssi debugging trick