<?php
add_filter( 'aioseo_sitemap_images', 'aioseo_filter_sitemap_images', 10, 2 );
function aioseo_filter_sitemap_images( $images, $post ) {
if ( ! function_exists( 'get_field' ) ) {
return $images;
}
$customImage = get_field( 'custom_image', $post->ID );
if ( ! empty( $customImage ) ) {
$images[] = wp_get_attachment_image_url( $customImage['id'] );