I have found a workaround for this issue. But first, please keep in mind, that I am not an developer and I am not really know what I am doing
It is working in my environment, but please check this workaround on your test site before running on production servers.
I have prepared simple wp function which is saving post featured image urls in the custom fields(featured_thumbnail_url, _featured_medium_url and _featured_large_url) on post save/ update. You can add the following code to the functions.php file:
//save featured image urls in the post custom fields
function save_featured_image_urls($id)
{
$featured_id = (int)get_post_thumbnail_id($id);
if (has_post_thumbnail( $id ) )
{
$thumbnail_url = wp_get_attachment_image_url( $featured_id, ‘post-thumbnail’ );
update_post_meta($id, ‘_featured_thumbnail_url’, $thumbnail_url);
$medium_url = wp_get_attachment_image_url( $featured_id, ‘post-medium’ );
update_post_meta($id, ‘_featured_medium_url’, $medium_url);
$large_url = wp_get_attachment_image_url( $featured_id, ‘post-large’ );
update_post_meta($id, ‘_featured_large_url’, $large_url);
}
}
add_action(‘save_post’, ‘save_featured_image_urls’);
I have also prepared some code which you can temporary add to the functions.php to update all posts with these custom fields. Run it once and delete it to avoid constant data update.
/ get all posts from blog
$query = new WP_Query(
array(
‘post_type’ => ‘post’,
‘posts_per_page’ => -1,
)
);
$all_posts = $query->posts;
foreach ($all_posts as $one_post) //set custom fields for all posts
{
$featured_id = (int)get_post_thumbnail_id($one_post->ID); //get featured image ID
if ($featured_id != 0)
{
$thumbnail_url = wp_get_attachment_image_url( $featured_id, ‘post-thumbnail’ );
update_post_meta($one_post->ID, ‘_featured_thumbnail_url’, $thumbnail_url);
$medium_url = wp_get_attachment_image_url( $featured_id, ‘post-medium’ );
update_post_meta($one_post->ID, ‘_featured_medium_url’, $medium_url);
$large_url = wp_get_attachment_image_url( $featured_id, ‘post-large’ );
update_post_meta($one_post->ID, ‘_featured_large_url’, $large_url);
}
}
/* Restore original Post Data */
wp_reset_postdata();