Try with get_the_ID()
$image_uploaded_meta_id = get_post_meta(get_the_ID(), '_listing_image_id', true);
get_the_ID()
is a core WordPress function that acts directly inside the WordPress Loop, retrieving the id of the current item being loaded. $post->id
is not working because the variable $post
has no scope inside the loop.
Here’s the link to the documentation: https://developer.wordpress.org/reference/functions/get_the_id/