Sorry for the repeated questions but I didn't get any solution yet!

I'm stuck with that!!

I mange a multi writers blog, and all our users uploading some gallery images, and they didn't know the difference between (attachment, media file or none). I found solution to hide the linking panel, but I am editing all the published posts to change the gallery images link to file "manually". :(

enter image description here

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.