How to Automatically Remove Default Image Links in WordPress

By | June 16, 2014
0
0



WordPress makes it super easy for you to upload images and create image galleries. However, one really annoying part about adding images to WordPress posts is that it automatically links the image to the media file. You can uncheck this option when adding an image, but sometimes you simply forget to uncheck it. In this article we will show you how to automatically remove default image links in WordPress.

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 bad user experience and affects your site’s bounce rate.

One solution is that you simply select the option disable the link each time, but it is not feasible because sometimes you simply forget.

Removing default image link option in WordPress

Removing Default Image Link in WordPress

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 or in a site-specific plugin.

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

Another way to do this is by installing and activating No Image Link plugin. It works out of the box and there are no options to configure. However, the plugin runs the option on every page, so it is better to simply add the code on your own.

Hopefully this will make adding images in WordPress a little less annoying specially if you never link to images. Do you link to image files on your site? Let us know by leaving a comment below.

Leave a Reply

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