Have you ever noticed whenever media files are uploaded like images, videos, etc., WordPress automatically creates an entirely a new webpage?
It’s called WordPress attachment page!
Unfortunately, WordPress attachment pages are not well known or even misinterpreted in WordPress
WordPress attachment pages have their own dedicated attachment post URL.What it contains are simple media files like images without any content. In addition, this obscure page type can allow user to comment on that page. It even get indexed by Google.
So, the WordPress attachment page may increase or decrease your SEO score, depending upon the way you prefer to use it.
Understanding WordPress Attachment Page concept:
If you’re a WordPress developer, you know that WordPress by default creates a single page for each attachment (such as images, audio, video, pdf, etc.). If you’re not, you would be surprise to know that attachment page is just like other pages such as page, post, custom post types.
The only difference is the post_type attribute that’s created on a WordPress database. You would have seen that Posts having a Post_Type attribute as “Post”, Pages having a Post_Type attribute as “Page” and in the same way, attachment having a Post_Type attribute as “attachment”.
Suppose, for an example you have uploaded two images
Let’s assume your post URL is
Now, you would be curious to know, how the WordPress attachment pages would look like. It just appends the attachment title to the post URL. Finally, it would look like below
Page 1: digitalmediaglobe.com/attachment-pages/photo-one/
Page 2: digitalmediaglobe.com/attachment-pages/photo-two/
Still curious! Try on your own. My live attachment pages would look like below. (Note: Now it was redirected to post URL)
Post URL: http://digitalmediaglobe.com/siteground-reviews/
WordPress Attachment Page URL: http://digitalmediaglobe.com/siteground-reviews/SiteGround-Quality-Crafted-Hosting-Services/
But, it’s worth considering that there are certain misconception about WordPress attachment page.People think that attachment page url is same as media attachment location url. Although, it’s totally different.In the above quoted example of an attachment page, it’s image location is defined by below URL
Image location URL: http://digitalmediaglobe.com/wp-content/uploads/2015/04/SiteGround-Quality-Crafted-Hosting-Services.png
Whether WordPress Attachment page is Good or Bad?
Well, it depends!
If you’re a photographer or media person, you’ll surely want to display your media file to your target customer by adding a nice caption, well-defined description, full detail and its occurrence. This definitely boosts your SEO standing.
Other than that, it’ll be counted as a thin page and this will definitely degrade your user experience and SEO score and increase your site’s bounce rate. Once, any of your media files, whether it’s your image, video or audio, starts becoming popular people might start to land on your media file page.
Ideally, it would be better if they land on your WordPress post directly instead of a WordPress attachment page.
How to fix WordPress attachment Page?
You can fix this issue by creating a 301 redirect from the attachment page back to the parent page where the media file (image, video/audio) is attached
There are multiple methods to do that. Let’s start with the easiest method.
Using WordPress Plugin:
WordPress SEO Plugin: If you’re using WordPress SEO by Yoast plugin, then definitely it’s the easiest way to fix it
You should follow the path: WordPress SEO -> Advanced -> Permalinks
And in last check the option “Redirect attachment URL’s to a parent post URL“.
Attachment Pages Redirect: If you’re not using WordPress SEO plugin, then you can download Attachment Pages Redirect plugin. It’s functionality remains the same as WordPress SEO by Yoast. It’ll redirect WordPress attachment pages to post parent, if any. If not, redirect to home page.
If you are among those who are not a big fan of WordPress Plugin, then you simply want to embed a piece of code. The redirection of an attachment page to a parent post can be done in two ways.
1. First Method: Create a new file in a WordPress theme folder and name it as image.php. If the image.php file already exists, no need to create a new one. After that, simply copy a code below and paste it. You’re done!
2. Second Method: Simply copy a code below and copy it in a function.php file of your child theme. That’s it!
How to Remove Attachment pages from Google Index:
If you don’t want to mess with a code or not even feeling comfortable to disable attachment pages. Other ways to do that are
1. Exclude attachment pages from your sitemap
2. If you’re using a WordPress SEO plugin, then you just follow the path
WordPress SEO -> Title & Metas -> Post Types
Simply check the noindex, nofollow tag only for the attachment post type.
Hopefully, the above talked methods had helped you to get rid of WordPress attachment pages, boosts your web traffic and in SEO improvement. I will be writing more about my findings in upcoming posts that will help you to increase site traffic.