WPBakery Question

  • I know you all know this already that WPBakery doesn’t play nice and you have a fix for posts but not pages I have 2 questions.

    1. `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 ),
    ‘alt’ => get_post_meta( $id, ‘_wp_attachment_image_alt’, true),
    );
    }
    }
    }
    }
    }

    return $images;
    }, 10, 2 );`

    Could ‘[vc_row’ just be ‘[vc_’ – might be a really dumb question because I know we keep that in a row but wouldn’t it just be just as effective is we open it up to all vc elements?

    2. To make this effective on pages can I just code it to do the same things on pages??

Viewing 1 replies (of 1 total)
  • Hi Michelle,

    Thanks for getting in touch with me.

    1. We have not tried that but please feel free to give it a shot and see if it works. I don’t think it will because vc_ might not be a correct field.

    2. Yes, absolutely.

    Please do not hesitate to let us know if you need our assistance with anything else.

    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 1 replies (of 1 total)

The ticket ‘WPBakery Question’ is closed to new replies.