At the moment, I’m using this function to display a default image where thumbnails are missing. But I need a proper solution. I want to display the correct thumbnail for each post.
function jeherve_custom_image( $media, $post_id, $args ) {
if ( $media ) {
return $media;
} else {
$permalink = get_permalink( $post_id );
$url = apply_filters( 'jetpack_photon_url', 'https://firmwarefile.com/wp-content/uploads/firmware.png' );
return array( array(
'type' => 'image',
'from' => 'custom_fallback',
'src' => esc_url( $url ),
'href' => $permalink,
) );
}
}
add_filter( 'jetpack_images_get_images', 'jeherve_custom_image', 10, 3 );
What about the existing posts? Unable to save Keyword+Meta Description on the published posts using the Classic Editor.