2 Methods to Remove Default Image Link in WordPress Automatically

No votes yet.
Please wait...

WordPress have made our blogging journey so easy, every one can use WordPress to build a powerful website. Creating posts, pages, and adding media files to WordPress is super easy after all it doesn’t require any coding experience. You can create image galleries without plugin. But an annoying part from WordPress media is that when we insert images to WordPress posts/pages, it automatically links the image to the media file. You can also add custom links in WordPress gallery images.

Why You Should Remove Default Image Link?

Let me tell, why do people hate it, because when a user click on the image from the post/page he will be redirected to the image link leaving behind the parent post/page. Now, the user got two options either close the window and search for another site or GO BACK. If the user closes the window then your site will be affected in SEO traffic. It’ll create bad user-experience and affects your WordPress blog’s bounce rate.

And in order to remove the media file link manually for each single image will consume your precious time, because you must un-check Link To → None if anyone want to unlink the media file link. Like so:

Remove the media file link from Images in WordPress
Remove the media file link from Images in WordPress

So, I’ve come up with 2 methods that helps you remove default image link in WordPress automatically.

Method #1: Removing Default Image Link in WordPress with the help of functions.php

It is very simple to disable the default image linking behavior in WordPress. All you have to do is add this code snippet in your theme’s functions.php file:

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);

Method #2: Removing Default Image Link in WordPress with the help of WordPress Plugin

Another way to do this is by simply installing and activating No Image Link plugin. It works like a charm, yet you would rather not configure any options. This plugin runs its option on every single page of your blog. Better rather installing this plugin, add the following code in your functions.php the following code will do the same as the plugin will:


Similar Posts

Leave a Reply

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