How to Remove the default image link when inserting images in WordPress

How to Remove the default image link when inserting images in WordPress!

Attachment Display Settings

You normally will come across this defaulted option when adding media to your post.

This will help you change the default for images so that when inserting an image into a post, you don’t have to de-select the media link option. This will save you a bit of time if you don’t often use images to make additional internal or external links.

Disclaimer: I am not responsible for any changes you make to your system, please proceed only after backing up the relevant files. If you are unsure of your capability, please consult an expert before making changes.

Please also note that not all code works for all themes due to the way they are implemented. If the code doesn’t work for you, you might be able to try the no image link plugin as an alternative.

I have gleaned this information from a tutorial at but have included one important addition to their data at the bottom of this tutorial.


Why is it useful?

Normally it drives me nuts to have to change it. It is only useful as a chosen option, not a default. You can save valuable time changing the default option, your images then become fire and forget. Predominantly you don’t want to link to an URL as it will hurt image searching from places like Google Image Search and Bing Image Search.


What should I do first?

Backup, backup and backup. As a rule of thumb I would always recommend a backup. In this case you only need to backup one file. If the changes fail, simply overwrite this file with the old version. This change is going to occur to the WordPress front end that you are managing your site from, so you won’t see the changes on your site, just when you go to insert a new image in a post.

Functions.php is the file you will be changing.

In the Bloggy theme this file was called Theme Functions.php.  The clue to this being the right file was that the editor placed functions.php in a bracket under it (functions.php)


How do I make the changes?

You need to go to the editor under appearance  in the WordPress side bar, locate functions.php and paste in a function. You then update the .php file.

Code for functions

Where do I put the code?

In the bloggy theme the functions.php is separated by some nice commented out lines to provide the boundaries for your functions, you can see these in the image above. You should position the code between functions. It doesn’t really matter if you place it at the start or the end of the .php file as long as you put it neatly between a function and use the same syntax.

Please Sir can I have the code so I can cut and paste it?

Of course you can, and in time honoured tradition it is in this wonderful pink colour that follows:

function wpb_imagelink_setup() {

              $image_set = get_option( ‘image_default_link_type’ );


                          if ($image_set !== ‘none’) {

                                       update_option(‘image_default_link_type’, ‘none’);



add_action(‘admin_init’, ‘wpb_imagelink_setup’, 10);


As a bit of geekberry info you can see above that if the $image_set variable is not equal to “None” a loop will perpetuate until it does equal “None” with the update_option pushing the variable to “None”.


What should I do after?

Test the code and make sure it is performing as expected.

I recommend logging out of your admin zone and logging back in again for it to take full effect. I’ve noticed that if you test it on the fly, it will work if you modify an image once it has been inserted into your document but it will still default to a media link when you upload a fresh image. Once you have logged back in again the code will take full effect and the images will not default to a media link after upload. didn’t explain this step in their tutorial but as many coders know, often a system will continue to work how it has before until it is reset.

If all is working as expected have  a biscuit in celebration. I would recommend either a chocolate Hobnob or a Garibaldi but if you are a commoner I suppose a Rich Tea would do….



  • Can this Tutorial be optimized? Let me know in the comments below.


Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.

CommentLuv badge