Visual Composer Images

#44119
  • Resolved John Horton
    Rank Math free

    Hi there.

    I seem to have an issue with rankmath not recognising images within Visual Composer. I have tried various elements like single image. Image gallery and do in. Can anyone offer any insight as to why this is happening?

    Regards

    John

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Rank Math is currently unable to parse through images on this page builder and add the links to the sitemap. You can however fix this by adding the following code snippet to your theme’s functions.php file:

    add_filter( 'rank_math/sitemap/urlimages', function( $images, $id ){
        if ( empty( $images ) ) {
            $post = get_post( $id );
            if ( $post && strpos( $post->post_content, '[vc_row' ) !== false ) {
                preg_match_all( '/(?:image|images|ids|include)\=\"([^\"]+)\"/', $post->post_content, $matches );
                foreach ( $matches[1] as $m ) {
                    $ids = explode( ',', $m );
                    foreach ( $ids as $id ) {
                        if ( (int) $id ) {
                            $images[] = array(
                                'src' => wp_get_attachment_url( $id ),
                                'title' => get_the_title( $id ),
                            );
                        }
                    }
                }
            }
        }
    
        return $images;
    }, 10, 2 );

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Thanks for this.

    I have added to the functions.php of my child theme and it’s still not working. I have cleared cache etc etc but still will not work.

    Todd
    Rank Math free

    Hello John,

    I am sorry for the confusion. The code we provided adds your VC images into the sitemap.

    About the issue you are facing with Rank Math not reading the content added by Visual Composer – we have added API access to the content analysis in the Rank Math plugin to make content from page builder plugins readable by Rank Math.

    You would need to contact the developer of the plugin you mentioned by showing the following link:
    https://rankmath.com/kb/content-analysis-api/

    Many known companies have already added the compatibility, as it takes a few hours:
    https://rankmath.com/compatibility/themify-builder/
    https://rankmath.com/compatibility/page-builder-framework/
    https://rankmath.com/compatibility/flothemes/

    I hope that helps. Please let us know if there’s anything else you need our assistance with. More than happy to help.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Visual Composer Images’ is closed to new replies.