Continue reading Indexing embedded PDFs for the parent post

Indexing embedded PDFs for the parent post

…WordPress. Thus, Relevanssi won’t know the PDF is embedded in the post and cannot index the PDF contents for the parent post. Most of these plugins use shortcodes to embed the PDF viewer on a page. To get Relevanssi to index the embedded PDF contents for the parent post, you……$upload_dir = wp_upload_dir(); foreach ( $matches[1] as $pdf ) { $pdf_url = ltrim( str_replace( $upload_dir[‘baseurl’], ”, urldecode( $pdf ) ), ‘/’ ); $pdf_content = $wpdb->get_var( $wpdb->prepare( “SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = ‘_relevanssi_pdf_content’ AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_attached_file’ AND meta_value = %s……meta_key = ‘_wp_attached_file’ AND meta_value = %s )”, $pdf_url ) ); $content .= $pdf_content; } } return $content; } If you use the Gutenberg block, the code is different and uses the relevanssi_block_to_render filter hook: add_filter( ‘relevanssi_block_to_render’, ‘rlv_pdfembedder_content’, 10 ); function rlv_pdfembedder_content( $block ) { if ( $block[‘blockName’] === ‘pdfemb/pdf-embedder-viewer’…

Read more Indexing embedded PDFs for the parent post 5 Comments on Indexing embedded PDFs for the parent post
Continue reading Chamber Dashboard Business Directory

Chamber Dashboard Business Directory

The Chamber Dashboard Business Directory plugin has a business directory search that’s not compatible with Relevanssi. To disable Relevanssi in those searches, add this to your theme functions.php: add_filter( ‘relevanssi_prevent_default_request’, ‘rlv_allow_chamber_search’, 10, 2 ); function rlv_allow_chamber_search( $prevent, $query ) { if ( isset( $_GET[‘searchtext’] ) ) { $prevent = false;…

Read more Chamber Dashboard Business Directory 0 Comment on Chamber Dashboard Business Directory
Continue reading Related Posts

Related Posts

…relevanssi_hits_filter filter hooks If you have a filtering function on relevanssi_hits_filter it may interfere with the related posts. Often these filter functions assume that the hits array has complete post objects and may check $hit->post_type to sort the results by post type. However, the hits array contains just post IDs……for the related posts, it’s easiest to disable it: add_action( ‘pre_relevanssi_related’, function() { remove_filter( ‘relevanssi_hits_filter’, ‘function_name’ ); } ); This action hook runs before the related posts queries and can be used to disable unwanted filters. Using phrases in Related posts searches Here’s an article about using phrases in Related……Now the filter can use the complete post object in $post_object to examine and filter the post, and when you save the post in the results array, $hit is used instead of $post_object to make sure you use the correct format. If the filter function is something you don’t need…

Read more Related Posts 0 Comment on Related Posts
Continue reading Premium 2.2.4.2

Premium 2.2.4.2

Relevanssi Premium 2.2.4.2 is a small bug fix, again fixing unexpected little details for the related posts feature. There was some deprecated JS code in the plugin, which caused issues for users who didn’t have the migration code on their site. Here’s the full changelog: Fixes couple of JS issues with the metabox scripts. Improves…

Read more Premium 2.2.4.2 0 Comment on Premium 2.2.4.2
Continue reading Premium 2.2.4.1

Premium 2.2.4.1

Version 2.2.4.1 of Relevanssi Premium fixes the problems the new Related Posts feature had. Here’s the changelog: It’s now possible to disable thumbnails and titles for related posts. The related posts custom template is looked for in the right place. Metabox buttons work without Gutenberg. Drafts shouldn’t appear in the related posts anymore. Choosing the…

Read more Premium 2.2.4.1 0 Comment on Premium 2.2.4.1
Continue reading Indexing HTML comments

Indexing HTML comments

…return $string; } This function attaches itself to the punctuation removal filter hook relevanssi_remove_punctuation and since it has priority 9, it runs before the default punctuation removal which runs on priority 10. This function then simply removes the HTML comment start <!, which causes Relevanssi to not remove the comments….…which is responsible for removing the comments – so that the comments are not removed. The solution is simple: add this function to your site and rebuild the index. add_filter( ‘relevanssi_remove_punctuation’, ‘rlv_keep_comments’, 9 ); function rlv_keep_comments( $string ) { $string = str_replace( ‘<!’, ”, $string ); return $string; } This…By default, Relevanssi does not index HTML comments inside your posts. Relevanssi removes all HTML tags before indexing, and HTML comments (<!– like this –>) are counted as HTML tags. If you have content inside comments that you want to be indexed, you need to modify the punctuation control –…

Read more Indexing HTML comments 0 Comment on Indexing HTML comments
Continue reading Toolset Views

Toolset Views

Relevanssi works fine with Toolset, thanks to a lot of compatibility code the makers of Toolset have included in it to make it work with Relevanssi. However, everything doesn’t work automatically without modifications. The key thing to notice with Toolset is that query variables and filters don’t work the way you’d expect. Because of the…

Read more Toolset Views 6 Comments on Toolset Views