• I want to change the Link Settings To ‘Media File’ as default setting. But after I edit the options.php file and change the ‘image_default_link_type’ to ‘file’ , It doesn’t work .When I insert a image to the post , the default setting is still ‘None’.

    How can I change it to ‘Media File’ ?

    Version 5.0.2

Viewing 15 replies - 1 through 15 (of 17 total)
  • @trlanfeng – I’m not certain what you are wanting to accomplish although if you are modifying any of the WordPress core files it would be _doing_it_wrong()

    Have a look in ../wp-includes/media.php, if you cannot find an appropriate hook to attach to in that file you should be able to trace out to one that may work.


    Thread Starter trlanfeng



    Sorry for my poor English. Maybe my expression is not very clear.

    When I insert a image block into the post , the Image Block Settings -> Link Settings -> Link To -> 'None' . The default is set to None .

    I just want to know , how can I change the default setting to Media File .

    And I just find the documentation and some post said that I can change the options.php -> image_default_link_type to file , but it doesn’t work.

    Thread Starter trlanfeng


    I found that the Link To default setting is write in thewp-includes/js/dist/block-library(min).js file at Line 3584.
    linkDestination: {
    type: ‘string’,
    default: ‘none’
    After I change the default to media , every image that I insert into the post , is Link To Media File as default now.
    But I don’t know how to change the default value in the function.php file

    @trlanfeng – Although I believe I now understand what you are looking at (using the Gutenberg editor: insert an image, click on Media Library … and you see the current images rather than your preference of the upload option) I do not have a specific solution but an observation.

    When you are writing your post/page go to the Featured Image option, work through the steps to upload a new image (you do not actually need to); then, if you go back to the editor and try to add an image you will find the image picker is still loading the upload file tab versus the existing library tab.

    Obviously not what you are asking but possibly a short-term work-around and new direction to look for a programmatic solution.


    Thread Starter trlanfeng


    Thanks for your help 🙂

    What trianfeng wants is for images in posts and pages to always by default be linked to the full size media files, so readers can click on them to see the full size version.

    Since Gutenberg/Block Editor has arrived, all images inserted into posts and pages are, by default, now linked to “none,” meaning linked to nothing.

    What he (and I) want is some way to make them default to linking to “media file” instead of none when they are inserted in the editor page.

    In the Classic Editor, WordPress remembered your last-used preference for this. Now it doesn’t do that anymore.

    A solution would be most helpful.

    • This reply was modified 5 years, 3 months ago by kevin_linden.

    I have the same need and agree with Kevin Linden’s interpretation of the original question/issue.

    Several Lightbox plugins create a full size image lightbox display for existing basic WP Galleries, but require that the the gallery link be set to media file.

    I want my Simple Lightbox plugin to be active/enabled for all my WP galleries.

    With recent updates, I must change every new gallery link value to media file in order for the Lightbox plugin to work for that gallery.

    And of course I frequently forget to do this… I want to change the default value from “none” to “Media File”.

    With previous versions of WordPress we were able to modify the default value by editing http://sitename/wp-admin/options.php, but this no longer works (when I look at options.php ‘image_default_link_type’ is set to “file”, but the default for all images & galleries is “none”).

    Anonymous User 14658531


    Is there anything new?

    I need this to work, to ensure that my Gallery-Lightbox works fine…

    Any suggestions to set the value permanently to my desire?

    seems like Options.php does not work for now :S

    I just ran into the same issue. A solution to this would be great. Thanks.

    Yes, I need this functionality, too. My wife creates a weekly blog post, mostly images, and she wants all images inserted with links to the media file. She’d rather not have to do this manually.

    Andy Schlei


    I also need this functionality. It is a pain to have to remember to change it every time I insert an image.

    Andy Schlei


    This, from Stack Exchange, appears to be a solution, but I don’t understand how to implement it.




    Does not look like a straightforward solution intended for non-programming admins and editors!

    I will continue to hope for someone to develop and share a packaged fix for this annoying change to WP.

    Andy Schlei


    I can program but the cryptic nature of the description of the fix leaves me not even knowing where to start.

    And I agree, this should be a simple check-box type configuration in the main WordPress App.



    One more person voting for a simple way to change the default Link Setting to media. Removing functionality is not a great thing to do.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘image_default_link_type doesn’t work’ is closed to new replies.