add_filter( ‘mylisting\listing\share\image’, function( $image, $listing ) {
$image = get_the_post_thumbnail_url( $listing->get_id(), ‘full’ ); // Ottenere l’URL dell’immagine in primo piano
if ( $image && filter_var( $image, FILTER_VALIDATE_URL ) !== false ) {
$image = esc_url( $image );
}
return $image;
}, 99, 2 );
add in functions.php child theme