Blocking HTML parts
-
Hi there,
we are using Beaver Builder for creating our content pages and Relevanssi for the search which are working fine together in general. But we have some troubles with one BB module that renders a related posts block which will be indexed by Relevanssi. I would like to block the whole HTML node that holds this related content block. So I came across the two filters relevanssi_post_content and relevanssi_excerpt_content but I am not able to write the correct regular expression, I guess. My current code in the functions.php of our theme:
add_filter( 'relevanssi_post_content', 'koe_rlv_pre_code', 10 ); add_filter( 'relevanssi_excerpt_content', 'koe_rlv_pre_code', 10 ); function koe_rlv_pre_code( $content ) { $content = preg_replace( '/<div id="related-stories-row"(.*)<\/div>/s', '', $content ); return $content; }As you can see, the surrounding div has the id related-stories-row which I am trying to address. But it doesn’t work. Any tips for me?
Thanks in advance!
The topic ‘Blocking HTML parts’ is closed to new replies.