Download Monitor: Index PDF content for parent page
Relevanssi can handle Download Monitor files without significant problems. If you want to use the “Index PDF contents for the parent page” option, there’s a problem, though. Download Monitor comes in between: the PDF post is attached to the Download Monitor dlm_download post and not the page where the [download]……grab that. $download_id = preg_replace( ‘/[^\d]/’, ”, $meta_field_value ); if ( $download_id ) { // Replace the original post_parent ID with the new one. $query = preg_replace( ‘/post_parent = \d+/’, “post_parent = $download_id”, $query ); } } return $query; } If the [download] shortcode is somewhere in the post content,……string The modified MySQL query. */ function rlv_download_monitor( $query, $post_id ) { $post_object = relevanssi_get_post( $post_id ); $id_matches = preg_match_all( ‘/\[download id=.(\d+).\]/ims’, $post_object->post_content, $matches ); if ( $id_matches ) { $download_id = implode( ‘,’, $matches[1] ); $query = preg_replace( ‘/post_parent = \d+/’, “post_parent IN ($download_id)”, $query ); } return $query;…