Latest Tech and Tips

How to Disable Image Attachment Pages in WordPress


Do you desire to disable image attachment pages in WordPress?

Image attachment pages can resemble insufficient pages on your website. If a site visitor sights these, after that it can leave a bad impact.

In this short article, we’ll reveal you how to disable image attachment pages in WordPress as well as reroute it to the moms and dad message.

How to disable image attachment pages in WordPress

Why Should You Disable Image Attachment Pages in WordPress?

By default, WordPress produces a solitary web page for every single media attachment you carry your website.

This consists of photos, audio/video data, pdfs, as well as a lot more. Some individuals could discover this capability helpful, nevertheless, most WordPress internet sites do not require it.

For instance, a digital photography motif might utilize the attachment web page to present EXIF information. This might reveal the video camera version made use of, the video camera setups, as well as also the image’s place information.

Often we obtain problems from individuals that mistakenly connected their photos to the attachment pages, as well as they do not such as the means it looks.

This is a large problem since numerous motifs do not have unique layouts for the image attachment pages.

Sometimes an image on your internet site can end up being prominent, as well as individuals could begin touchdown on the attachment web page straight from Google.

Ideally, you desire site visitors to arrive on your message as well as see the image in the context you have actually utilized it.

This is why we constantly advise individuals to disable image attachment pages on their WordPress blog site.

How to Disable Image Attachment Pages in WordPress (2 Methods)

There are 2 methods to disable image attachment pages in WordPress.

The very first strategy usages WordPress plugins, while the 2nd entails including customized code to WordPress.

You’ll desire to pick the approach that’s ideal matched for your abilities.

Method 1: Disable Image Attachment Pages in WordPress (with a Plugin)

The simplest means to disable image attachment pages is to utilize a WordPress plugin. This approach is novice pleasant as well as calls for no coding.

We advise utilizingAll in One SEO It’s the most effective SEO plugin for WordPress made use of by over 2 million websites.

The very first point you’ll require to do is mount as well as trigger the plugin. To do this, see our overview on how to mount a WordPress plugin.

Once the plugin is mounted as well as triggered, you’ll have a brand-new food selection product called‘All in One SEO’

Navigate to All in One SEO”Search Appearance Next, click the ‘Media’ navigating tab.

All in One SEO search appearance media setting

The very first setup is‘Redirect Attachment URLs’ You can disable the setup totally, reroute to the attachment web page, or the attachment moms and dad web page.

We advise rerouting to the ‘Attachment Parent’ web page. That means, when an individual arrive at the image attachment web page, they’ll be rerouted to your short article rather.

All in One SEO select attachment parent

Once you pick your favored setup, make certain to click ‘Save Changes’ prior to leaving the display.

If you aren’t utilizing the All in One SEO plugin, you can still disable image attachment pages as well as reroute individuals to a moms and dad message utilizing a plugin called Attachment Pages Redirect.

All you have to do is mount as well as trigger the plugin. It’ll immediately begin rerouting individuals that arrive on attachment pages to the moms and dad message.

If no moms and dad message is located, after that individuals will certainly be rerouted to your homepage.

This plugin functions out of package as well as has no setups web page. Simple as well as simple.

Method 2: Disable Image Attachment Pages in WordPress (with Code Snippet)

Another alternative is to include a code bit to WordPress that achieves the very same objective as the plugin over.

If you do not desire to utilize a plugin or really feel that you’re currently utilizing a lot of WordPress plugins, after that you can utilize this approach.

First, you’ll require to develop a brand-new documents in your WordPress motif folder as well as name it image.php If your motif currently has an image.php documents, after that you’ll require to modify that documents rather.

After that, all you have to do is include the adhering to code as the very first line in your image.php documents: