Yoast Descriptions and Visual Composer Resolution

, ,

So I ran into an issue where Yoast SEO was not auto-generating an excerpt for use within the Meta Description when a visual composer is being used.  When I say visual composer I mean like Divi or WP Bakery Visual Composer.  I was able to track down a filter that seems to have resolved the issue.

// FIX SEO incompatibility with visual composer
add_filter( 'wpseo_replacements', function( $replacements ){
    global $post;

    if( ! sizeof($replacements) && ! empty($post->post_content) ){
        $replacements['%%excerpt%%'] = wp_html_excerpt( do_shortcode( $post->post_content ), 155 );

    return $replacements;



Posted on

July 10, 2018

Submit a Comment

Your email address will not be published. Required fields are marked *