-
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??
The ticket ‘WPBakery Question’ is closed to new replies.