Continue reading Translation and multilingual plugins

Translation and multilingual plugins

Different translation plugins use different methods for storing the translations, and these methods have varying compatibility with how Relevanssi works with the posts. Best compatibility Polylang. Relevanssi has good built-in support for Polylang. This is the best translation tool that causes the least trouble. WPML. Good built-in support, almost as……good as Polylang. WPML is more prone to causing weird edge case problems. MultilingualPress. Uses separate multisite sites for each language. This works well with Relevanssi, making language filtering automatic. With Relevanssi Premium, you can do multisite searching to include posts in different languages. Not compatible TranslatePress. The translated strings…

Read more Translation and multilingual plugins 0 Comment on Translation and multilingual plugins
Continue reading Integrating Post Views Counter stats

Integrating Post Views Counter stats

It’s possible to integrate all kinds of external data to Relevanssi weights. Post Views Counter is an analytics plugin that collects stats about your visitors and stores them in the local database, which means those stats are available for Relevanssi. For some sites, this makes a lot of sense. For example, I have Kirjavinkit, a book review site…

Read more Integrating Post Views Counter stats 0 Comment on Integrating Post Views Counter stats
Continue reading GeneratePress: Query Loop

GeneratePress: Query Loop

Relevanssi doesn’t work automatically with the Query Loop block in GeneratePress and GenerateBlocks. Fortunately, the solution is simple: the Query Loop block has a filter hook for adjusting the query parameters, and you can use that filter hook to enable Relevanssi. Add this to your site: add_filter( ‘generateblocks_query_loop_args’, function( $query_args,…

Read more GeneratePress: Query Loop 0 Comment on GeneratePress: Query Loop
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: add_filter( ‘relevanssi_post_ok’, ‘relevanssi_aelia_compatibility’, 10, 2 ); function relevanssi_aelia_compatibility( $post_ok, $post_id ) {…

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…

Read more PublishPress Revisions: duplicate posts 0 Comment on PublishPress Revisions: duplicate posts
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……these functions to your site: add_action( ‘woocommerce_product_set_stock_status’, function( $product_id ) { relevanssi_insert_edit( $product_id ); } ); add_action( ‘woocommerce_variation_set_stock_status’, function( $product_id ) { relevanssi_insert_edit( $product_id ); } ); Now whenever a product stock status changes, Relevanssi is notified and reindexes the post. This will remove the post from the index if……WordPress post update that Relevanssi listens to, and Relevanssi doesn’t know the post has changed. Thus the change in stock status goes unnoticed until something saves the post or rebuilds the index. The fix for this is simple, fortunately. You can make Relevanssi listen to product stock status changes. Add…

Read more WooCommerce: Make Relevanssi notice stock changes 0 Comment on WooCommerce: Make Relevanssi notice stock changes
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
Continue reading Polylang: Bilingual search

Polylang: Bilingual search

…) { $language = pll_current_language() === ‘en’ ? ‘fr’ : ‘en’; // Adjust language codes if necessary $translated_post_id = pll_get_post( $post->ID, $language ); if ( $translated_post_id ) { $translated_post = get_post( $translated_post_id ); $content .= ‘ ‘ . $translated_post->post_content; $content .= ‘ ‘ . $translated_post->post_title; } return $content; } This…

Read more Polylang: Bilingual search 8 Comments on Polylang: Bilingual search
Continue reading ACF: Indexing files from File fields

ACF: Indexing files from File fields

Relevanssi can index attachment contents from files linked to posts with ACF File fields. This does not happen automatically but requires some extra code. The code required depends on which return value you use for your ACF File fields. If you use “File ID”, the code looks like this: add_filter(…

Read more ACF: Indexing files from File fields 1 Comment on ACF: Indexing files from File fields