How to Automatically Remove Default Image Links in WordPress
-
by cobra_admin
- 48
WordPress makes it super easy for you to upload images and create image galleries.
However, older versions of WordPress automatically linked the image to the media file.
In this article, we will show you how to automatically remove default image links in WordPress.

Note: WordPress no longer adds default image links when you upload images to your posts or pages. However, if you are still using an older version or see this behavior on your website, then you can try the following steps.
Why You Should Disable Default Image Links in WordPress
By default, WordPress links images to themselves. A user sees that the image is a link, clicks it and they are then taken to the image file.
From this page the user has two options: click the ‘back’ button in their browser or move on to another site.
Usually, it is the latter. It also affects your image SEO traffic because search engines could redirect users to the link used for the image instead of your post.
Overall, it creates a bad user experience and affects your site’s bounce rate.
One solution is that you simply select the option to disable the link each time, but it is not feasible because sometimes you simply forget.

Removing Default Image Link in WordPress
It is very simple to disable the default image linking behavior in WordPress. However, you’ll need to add some code to your WordPress website. If you have not done this before, then take a look at our guide on how to copy and paste code snippets in WordPress.
All you have to do is add this code snippet in your theme’s functions.php file, a site-specific plugin, or a code snippets plugin.
12345678 | 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); |
Hosted with ❤️ by WPCode
1-click Use in WordPress
This code basically tells WordPress to update the image_default_link_type
option and set it to ‘none’. This option is then stored in your WordPress database.
We recommending adding the code snippet with WPCode. It’s the best code snippets plugin and makes it easy to add custom code in WordPress without editing your theme’s functions.php file. That means you don’t have to worry about breaking your site.
First, you’ll need to install and activate the free WPCode plugin. For detailed instructions, see our guide on how to install a WordPress plugin.
Next, go to Code Snippets » + Add Snippet from the WordPress dashboard. Then, go to the ‘Add Your Custom Code (New Snippet)’ option and click on the ‘Use snippet’ button.

After that, you can add a title for your code snippet. This can be anything to help you remember what the code is for.
Then, simply paste the code snippet from above into the ‘Code Preview’ box and choose ‘PHP Snippet’ as the code type from the dropdown menu.

Lastly, toggle the switch from ‘Inactive’ to ‘Active’ and click on the ‘Save Snippet’ button at the top of the page.

Now, go ahead and add a new image in WordPress. You’ll notice that it no longer links to the image file or the attachment page. This will make adding images in WordPress a little less annoying, especially if you never link to images.
If you want to learn how to add links to an image or gallery images, then you can follow our guide on how to add custom links to gallery images in WordPress.
We hope this article helped you learn how to automatically remove default image links in WordPress. You may also want to see our tutorial on how to add and align images in WordPress posts and pages or check out our picks of the best Instagram plugins for WordPress.
WordPress makes it super easy for you to upload images and create image galleries. However, older versions of WordPress automatically linked the image to the media file. In this article, we will show you how to automatically remove default image links in WordPress. Note: WordPress no longer adds default image links when…
WordPress makes it super easy for you to upload images and create image galleries. However, older versions of WordPress automatically linked the image to the media file. In this article, we will show you how to automatically remove default image links in WordPress. Note: WordPress no longer adds default image links when…