Link to resized media file

You can use the get_the_post_thumbnail_url explained here So, the code would be <a href=”https://wordpress.stackexchange.com/questions/279104/<?php echo get_the_post_thumbnail_url(get_the_ID, array (2000, 1500) ) ?>” >……. </a>

Remove after images

You can try this way function filter_ptags_on_images($content) { $content = str_replace( “><p></p>”, “”, $content ); } add_filter(‘the_content’, ‘filter_ptags_on_images’); Let it give a try