Continue reading Premium 2.27 / Free 4.24

Premium 2.27 / Free 4.24

…relevanssi_truncate_index for potential compatibility integrations. Premium. Minor fix: Related posts keyword source taxonomy list now shows the taxonomy slug to distinguish between taxonomies with the same name. Premium. Minor fix: Building excerpts from PDF content didn’t work in multisite context, leading to wrong excerpts or no excerpts at all. Minor……in 2.26.1 and 2.27.0, and once you’ve updated to 2.27.1, you can remove the snippet. 2.27.0 / 4.24.0 Premium. New feature: You can now set the rlv_source parameter in a search form and then filter the search logs based on that. See relevanssi_valid_sources. New feature: New filter hooks relevanssi_after_index_doc_n and…

Read more Premium 2.27 / Free 4.24 0 Comment on Premium 2.27 / Free 4.24
Continue reading Premium 2.26 / Free 4.23

Premium 2.26 / Free 4.23

…the search results by default to protect their contents. Premium. Minor fix: Click-tracking front-end JS code now uses wp_print_inline_script_tag(). Premium. Minor fix: Related posts template CSS now uses wp_add_inline_style(). Premium. Minor fix: An array _rt tag won’t cause a fatal error anymore. Premium. Minor fix: To avoid crashes, the Relevanssi……feature: Relevanssi settings tabs have more CSS IDs to help hide individual settings. New feature: Support for the post_mime_type query parameter. Premium. Changed behaviour: The pre_relevanssi_related and post_relevanssi_related action hooks get the post ID as a parameter, as it’s not always available otherwise. Changed behaviour: Password-protected posts are excluded from……enabled with a filter function. 2.26.1 / 4.23.1 Security fix: Prevent an XSS attack by a malicious contributor. This attack is based on a contributor injecting an attack in a custom field name. It then gets triggered if the admin views the list of custom field names in the indexing…

Read more Premium 2.26 / Free 4.23 0 Comment on Premium 2.26 / Free 4.23
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: Thanks to Ben Knowles. If you are using V2…

Read more GeneratePress: Query Loop 0 Comment on GeneratePress: Query Loop
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: 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 the admin search. This is…

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

Korean postpositions

…’은’ === $end1 && $len > 2 ) { $term = substr( $term, 0, -1 ); } elseif ( ‘에’ === $end1 && $len > 2 ) { $term = substr( $term, 0, -1 ); } elseif ( ‘는’ === $end1 && $len > 2 ) { $term = substr(…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: add_filter( ‘relevanssi_stemmer’, ‘relevanssi_korean_plural_stemmer’ ); function relevanssi_korean_plural_stemmer( $term ) { $len = strlen( $term ); $end1 = substr( $term, -1, 1 ); if (……0, -1 ); } elseif ( ‘의’ === $end1 && $len > 2) { $term = substr( $term, 0, -1 ); } return $term; } 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…

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……$block; } ); This function uses the relevanssi_block_to_render filter hook. Whenever a core/file block is encountered, the function fetches the file contents from the _relevanssi_pdf_content custom field for the attachment post and replaces the block contents with that. This works great for indexing but does not include the file contents……this function to your site to index the contents of files added with the File block: add_filter( ‘relevanssi_block_to_render’, function( $block ) { if ( ‘core/file’ === $block[‘blockName’] ) { $file_id = $block[‘attrs’][‘id’]; $file_content = get_post_meta( $file_id, ‘_relevanssi_pdf_content’, true ); if ( $file_content ) { $block[‘innerContent’][0] = $file_content; } } return…

Read more Indexing attachments from File blocks 0 Comment on Indexing attachments from File blocks