Really I'm gonna be crazy :(, After searching for two months no one talking about this issue!!
I'm stuck with that!!
I mange a multi writers blog, and all our users uploading gallery images, and they didn't know the difference between (attachment, media file or none), I'm using Lightbox plugin and working only when images linked to file.
Before WordPress version 5+ I was linked all gallery images to "file" automatically by using this filter below.
add_filter( 'shortcode_atts_gallery',
function( $out ){
$out['link'] = 'file';
return $out;
}
);
But after WP 5+ how can I make it to work again? I really need to link all gallery images to "media file" automatically!
I hope someone will help me or even giving me the right way.
Thanks for your time.