Continue reading Year filter from the search query

Year filter from the search query

A good question was asked in the post Natural-language date queries: Is it possible to extend this so that I can simply add a the year in the search and only results from that year would show? The answer is yes! Add these functions to your site: The code consists of two functions. The first…

Read more Year filter from the search query 0 Comment on Year filter from the search query
Continue reading WooCommerce: Aelia Prices by Country product visibility

WooCommerce: Aelia Prices by Country product visibility

Aelia has a Prices by Country for WooCommerce plugin, which can adjust prices based on customer country and hide products unavailable in a specific country. Jason James shared a function that makes Relevanssi hide unavailable products in search: This function uses the relevanssi_post_ok filter hook to control which posts are included in the search and…

Read more WooCommerce: Aelia Prices by Country product visibility 0 Comment on WooCommerce: Aelia Prices by Country product visibility
Continue reading PublishPress Revisions: duplicate posts

PublishPress Revisions: duplicate posts

PublishPress Revisions causes duplicates to appear in Relevanssi search results when a revision is approved. When the revision is created, Relevanssi indexes it because it has the same post type as the original post with the post status draft. Relevanssi indexes drafts because people may want to search for them in the admin search. This is…

Read more PublishPress Revisions: duplicate posts 0 Comment on PublishPress Revisions: duplicate posts
Continue reading Korean postpositions

Korean postpositions

Korean has postpositions, which complicate things for Relevanssi. Fortunately, it’s easy to clean up the most common postpositions from the words. Add this function to your site: After you’ve added this function, rebuild the index. You also need to adjust the minimum word length to 2, as many Korean words are only two characters long.…

Read more Korean postpositions 0 Comment on Korean postpositions
Continue reading Indexing attachments from File blocks

Indexing attachments from File blocks

The Relevanssi attachment indexing assumes the files are connected to the posts using the WordPress attachment mechanism. What if you don’t use that but instead add the files to the pages using the File block in the block editor? That’s not a problem, but it requires some extra code. Add this function to your site…

Read more Indexing attachments from File blocks 0 Comment on Indexing attachments from File blocks
Continue reading WooCommerce: Make Relevanssi notice stock changes

WooCommerce: Make Relevanssi notice stock changes

In some cases, WooCommerce product stock level changes don’t affect the search immediately. If the search is set up to exclude out-of-stock items, a product that sells out may still be included in the search until the next reindexing. This happens because changes in the stock status don’t trigger a WordPress post update that Relevanssi…

Read more WooCommerce: Make Relevanssi notice stock changes 0 Comment on WooCommerce: Make Relevanssi notice stock changes
Continue reading Only return exact title matches if possible

Only return exact title matches if possible

We have posts with titles like “A perfect match”. If a user searches for this exact title, only this post should show up in the results. Otherwise, the search should run as default. There are several approaches to this, but the best is relevanssi_hits_filter. This function goes through all the posts, checks if the post…

Read more Only return exact title matches if possible 0 Comment on Only return exact title matches if possible
Continue reading FileBird: Filtering attachments by folder

FileBird: Filtering attachments by folder

FileBird is one of many WordPress plugins that provide more control over the attachments in the Media Library. You can use the FileBird folders in Relevanssi searches to filter attachments based on their folder. Here’s a simple function you can add to your site: Once you add this, you can use the folder parameter to…

Read more FileBird: Filtering attachments by folder 0 Comment on FileBird: Filtering attachments by folder