WordPress by default creates a single page for each attachment that you have on your site. This includes images, audio/video files, pdf, etc. This functionality is great for photographers, but not so much for the rest of us. See now how to disable the attachments page in WordPress.
The bad news is that this page will be published by default, which means that it can be accessed by the general public. You don’t need to attach the media file to a post or page in order for it to be visible.
Sometimes an image on your website can become popular and people might start landing on the attachment page directly from Google. Ideally you would want them to land on your post and see the image in the context you have used it. In this article, we will show you how to disable image attachment pages in WordPress.
Most of you will want to prevent that from happening, either because you have a media file that you don’t want to be accessed by everybody, or because the attachment page looks pretty bad because the theme developers don’t pay any attention to it. I page that looks pretty weird, no? Just the file, its title, your sidebar, comment area, Therefore, in this article, I’ll show you how to disable the attachment pages in WordPress with one of these two plugins.
WordPress Attachments Page Disable Guide
Yoast SEO Plugin
For those of you which are using the Yoast SEO plugin – and all of you should use it because it will make your life so much easier, not just for SEO; it’s a must-have plugin – you just need to activate an option.
- Go to SEO -> Search Appearance;
- Select the Media tab;
- Select the Yes option under Redirect attachment URLs to the attachment itself?;
- Click the Save Changes button.
The versions prior to 7.0, would have redirected the attachment page to the parent post.
Starting with Yoast 7.0, it will redirect the attachment page to the media file itself, which is much better.
Attachment Pages Redirect Plugin
For those of you that don’t have Yoast installed, and don’t want to have it either, especially for just one feature, then install Attachment Pages Redirect, which handles just that.
Once activated, it will perform a 301 redirect (permanent redirect) from the attachment page to the parent post, if the media file is attached there. If it’s not attached, then it will perform a 302 redirect (temporary redirect) to your homepage.
The plugin doesn’t have any settings. You just have to activate it, that’s it.
Hope you found the post useful and it helped you! Don’t forget to share it with your friends! If you have any questions or thoughts, drop a comment, contact us or message us on Facebook.