Visual Composer: Indexing headings
Relevanssi doesn’t by default index the headings in Visual Composer. The vcex_heading
shortcode Visual Composer for the headings stores the heading text inside a shortcode attribute. By default, Relevanssi does not index shortcode attributes.
In this case, indexing the shortcode attribute is necessary. Fortunately, it’s easy to fix with a simple function added to your site:
add_filter( 'relevanssi_pre_excerpt_content', 'rlv_shortcode_attribute', 8 ); add_filter( 'relevanssi_post_content', 'rlv_shortcode_attribute', 8 ); function rlv_shortcode_attribute( $content ) { return preg_replace( '/\[vcex_heading.*?text="(.*?)".*?\]/im', '\1 ', $content ); }
After you add this function, rebuild the index. Now the headings are included in the index. This function is added to two hooks: relevanssi_pre_excerpt_content
handles the excerpts and relevanssi_post_content
the indexing.