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 Premium 2.8 / Free 4.7

Premium 2.8 / Free 4.7

These versions add new features, but these are mostly small and of interest to developers. As a big change Relevanssi is now active in Media Library searches in the admin backend (if admin searches are enabled): feedback on this is welcome. Excerpts should be slightly better, especially when content stopwords are involved and post part…

Read more Premium 2.8 / Free 4.7 2 Comments on Premium 2.8 / Free 4.7
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