How to Remove Automatic Image Links in WordPress (2023 Expert Guide)

Hello there! If you‘ve been working with WordPress for any length of time, you‘ve likely noticed that it automatically turns images you upload into links. When a visitor clicks that image, instead of enlarging it as they might expect, they get whisked away to the media file URL. Not ideal, right?

In this guide, I‘m going to deep dive into:

  1. Why WordPress started doing this in the first place
  2. The problems it causes and why you should disable it
  3. Exactly how to remove those pesky auto-generated image links, step-by-step

By the end, you‘ll be armed with the knowledge to take back control of your image links. Let‘s get into it!

Some Background: WordPress‘ Auto-Linking Habit

So why did WordPress adopt this quirky behavior of linking every inserted image to its own attachment page? Well, back in the day (pre-WordPress 4.7 to be exact, which rolled out in December 2016), the thinking was this made it easy for visitors to access the full-size version of an image.

WordPress 4.7 release post
The introduction of WordPress 4.7 in 2016, which removed the default image linking behavior. (Source: WordPress.org)

It seemed to make sense at the time – if someone wanted to see more detail, they could just click the image. The reality, though, is that this default caused more headaches than it solved (more on those in a bit).

How Common Is This Issue?

You might be wondering: if WordPress removed this auto-linking way back in 2016, why are we still talking about it now? Well, even though WordPress itself no longer adds links to newly uploaded images by default, many existing sites still have this setting enabled.

In fact, a 2020 study by SEO tool Ahrefs found that a whopping 63% of websites had at least one image linking to its own attachment page. That‘s a lot of potenially frustrated visitors!

Ahrefs study data on image links
Data from Ahrefs showing how prevalent image attachment links still are. (Source: Ahrefs)

So even if you‘re running a more recent version of WordPress, it‘s worth checking if your images are linking out unintentionally. Chances are at least a few of them are, and it‘s an easy win to clean those up.

Why You Should Remove Automatic Image Links

Alright, so we‘ve established that image links are still very much a thing on most WordPress sites. But why is that such a big deal? Let‘s break down the key reasons you‘ll want to give auto-linking the boot:

1. It‘s jarring for visitors

Picture this: a reader is happily scrolling through your latest post, thoroughly absorbed in your brilliant prose. They see an image that catches their eye and click for a closer look. But instead of the image zooming in, they‘re suddenly transported to a whole new page showing just the image. Talk about disorienting!

Now they have to fumble for the back button, find their place in the article again, and try to regain their momentum. Chances are they won‘t bother – in fact, data from Google shows that 53% of visitors will abandon a page if it takes more than 3 seconds to load. Unintentional image links are a surefire engagement killer.

2. It‘s poison for your SEO

An image attachment page is essentially a dead end from an SEO perspective. It contains no meaningful content other than the image itself, so search engines have no reason to rank it for keywords or funnel traffic there.

Instead, you want search engines (and users) to land on the actual page the image is embedded in, where it has relevant context. Letting your images link to throwaway attachment pages rather than their "home" post or page is an easy way to orphan them and miss out on valuable SEO juice.

3. You lose control over the user journey

As a site owner, YOU want to be the one deciding where your visitors go and what actions they take. Every link on your site should serve a clear purpose, whether that‘s encouraging a product purchase, newsletter sign-up, or just continued reading.

Automatic image links throw a wrench in your carefully crafted user flows by creating unintentional exit points. Instead of being thoughtfully guided through your site, visitors are left to fend for themselves on dead-end attachment pages. Not exactly the seamless, conversion-optimized experience you‘re aiming for, is it?

How to Rid Your Site of Automatic Image Links for Good

Okay, you‘re sold on the need to eliminate those default WordPress image links. So how do you go about it? There are two main routes you can take:

Option 1: Remove links with code

If you‘re comfortable working with your WordPress theme‘s files, you can banish auto-linking with a simple code snippet:

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

To use this snippet, you‘d simply paste it into your theme‘s functions.php file or a site-specific plugin. Here‘s what it does:

  1. Checks if the image_default_link_type option is set to anything other than ‘none‘ (i.e. if images are still set to link to something).
  2. If so, it updates that option to ‘none‘, effectively disabling the links.
  3. The add_action line ensures this code runs whenever an admin page loads in WordPress.

If you go this route, just be sure you‘re using a child theme so your changes don‘t get overwritten when you update WordPress or your theme. You can also use a plugin like Code Snippets to manage custom code without directly editing any files.

Option 2: Use a dedicated plugin

Not keen on fiddling with code? No worries – there are also several handy plugins built solely for the purpose of removing those pesky image links:

  • Disable Image Links: Does exactly what it says and nothing more. Install, activate, and bask in the glory of linkless images. 50,000+ active installations.
  • WP Image Link Remover: Along with nixing links sitewide, this plugin also lets you keep links on a per-image basis by adding a CSS class. Useful if you want to be selective. 3,000+ active installations.
  • Auto Image Attributes From Filename: This one‘s a bit more of an all-rounder. In addition to stripping image links, it also automatically sets alt and title attributes based on the image filename. A nice timesaver to knock out a few image SEO best practices at once. 100,000+ active installs.

Any of these will get the job done, so pick your poison based on your needs and preferences.

When You SHOULD Link Images (And How to Do It Right)

Now, all this talk of removing image links might have you thinking they‘re always a no-no. But there are definitely times when linking images is the right move UX-wise, such as:

  • Linking a product photo to its purchase page
  • Turning an infographic into a clickable link to a full-size version
  • Linking a thumbnail image to the full blog post or page

The key is to be intentional and use links to direct visitors to relevant "next steps" rather than dead ends. When you do link images, keep these best practices in mind:

Make it obvious

Use visual cues like borders, hover effects, or captions to signal that an image is clickable. Don‘t make visitors guess.

Set the target wisely

Consider opening image links in a new tab/window using the target="_blank" attribute. That way visitors can easily explore the linked content without navigating away entirely.

Use descriptive alt text

Accessibility matters for linked images too! Make sure to include alt text that clearly describes the image and where the link goes, e.g. "Product X photo (links to purchase page)". This helps screen readers and search engines understand your links.

Optimize image size and quality

Large, unoptimized images are a drag on page speed, which is a drag on UX and SEO. Before uploading, resize your images to the max dimensions needed and compress them to strike a balance between file size and quality. Aim for less than 100-150KB per image.

Key Takeaways & Next Steps

I know we just threw a lot at you, so let‘s recap the key points:

  1. WordPress used to add links to images automatically, which caused all sorts of issues for visitors and site owners alike.
  2. Although WP has since changed this default, the majority of sites still have some unintentional image links floating around.
  3. You can remove these links quickly via a code snippet or plugin to improve UX, SEO, and conversion flows.
  4. If you do choose to link certain images, be strategic about it and follow best practices to optimize the experience.

Now for some action steps! If you take nothing else away from this guide, do these three things:

  1. Audit your site for unintentional image links using a tool like Screaming Frog or Sitebulb.
  2. Remove those links sitewide using one of the methods outlined above.
  3. Implement a clear strategy for intentionally linking images where it makes sense.

Your visitors (and bottom line) will thank you! If you have any other questions about managing images in WordPress, feel free to get in touch – I‘m always happy to help.

Credits: This post was inspired by the great folks at WPBeginner, Kinsta, and Yoast whose work on this topic informed much of my research.

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.