[ad_1]
I added DearFlip to the list. Here’s the code for it:
add_filter( 'relevanssi_content_to_index', 'rlv_dearflip_content', 10, 2 );
function rlv_dearflip_content( $content, $post ) {
$m = preg_match_all( '/\[dflip.*?id=["\'](.*?)["\']/', $post->post_content, $matches );
if ( $m ) {
global $wpdb;
$upload_dir = wp_upload_dir();
foreach ( $matches[1] as $flipbook_id ) {
$data = get_post_meta( $flipbook_id, '_dflip_data', true );
$pdf_url = ltrim( str_replace( $upload_dir['baseurl'], '', urldecode( $data['pdf_source'] ) ), '/' );
$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 )", $pdf_url ) );
$content .= $pdf_content;
}
}
return $content;
}However, this doesn’t work in the free version of Relevanssi because you need Relevanssi Premium to index the PDF contents.
