Upload an image to WordPress. Now visit yoursite.com/?attachment_id=123. You’ll see a full page — with your theme’s header, footer, sidebar — displaying a single image. No meaningful text. No context. Just an image wrapped in your site’s layout.
That’s an attachment page. WordPress creates one for every single media file you upload. Every image, every PDF, every video. Each one is a fully indexable URL with almost zero content.
If you’ve uploaded 500 images, you have 500 thin-content pages that Google can crawl, index, and judge your site by.
What are attachment pages?
WordPress treats uploaded media as a special post type called “attachment.” Each attachment gets its own permalink, just like posts and pages. By default, these URLs are publicly accessible.
An attachment page typically shows: the media file (image, video, etc.), the file title, and maybe a caption — all wrapped in your theme’s templates. For most themes, this means a full-page layout with your header, navigation, sidebar, and footer surrounding a single image.
From a content perspective, these pages are nearly empty. They exist because WordPress’s architecture treats everything as a post, and posts need URLs.
Why should you care?
Thin content penalty. Google’s quality guidelines specifically warn against pages with little to no original content. Hundreds of attachment pages with just a single image each dilute your site’s overall content quality.
Crawl budget waste. Googlebot has a limited crawl budget for your site. Every request spent on an attachment page is one not spent on your actual content. For large media libraries, this is significant.
Duplicate content confusion. The image on an attachment page is the same image embedded in your actual posts. Two URLs serving the same content, with the attachment page being the weaker version.
Users land on them accidentally. If Google indexes an attachment page and someone clicks through from search results, they see a nearly empty page. Bad user experience, high bounce rate.
The quick fix
// Redirect attachment pages to the parent post or homepage
add_action( 'template_redirect', function() {
if ( is_attachment() ) {
global $post;
$parent_url = ( $post && $post->post_parent )
? get_permalink( $post->post_parent )
: home_url( '/' );
wp_redirect( $parent_url, 301 );
exit;
}
});
This 301-redirects all attachment pages to either the parent post (if the image was uploaded to a specific post) or the homepage. The redirect passes link equity and tells Google the page has permanently moved.
Note: WordPress 6.4+ added a built-in option to redirect attachment pages. Check Settings → Reading for a related setting, but the implementation varies by version.
The one-click solution
OvKit includes Disable Attachment Pages under Features → Cleanup. One toggle redirects all attachment URLs to their parent post or homepage with a proper 301 redirect.
What happens after you fix this?
- All attachment pages 301-redirect to meaningful content
- Thin content removed from Google’s index (gradually, as Google re-crawls)
- Crawl budget reclaimed for your actual pages
- No more accidental attachment page visits from search results
FAQ
### Will this break my media library or image embedding?
No. Images embedded in posts and pages work through direct file URLs (/wp-content/uploads/image.jpg), not attachment page URLs. Redirecting attachment pages has zero impact on how images display in your content.
### Yoast/RankMath already redirects attachment pages — do I need this?
If you have Yoast SEO or RankMath configured to redirect attachment pages, you don’t need a separate solution. Check your SEO plugin’s settings first. OvKit is useful if you’re not running a full SEO plugin or want to keep your SEO plugin lightweight.
### Will existing Google-indexed attachment pages cause problems?
The 301 redirect tells Google to transfer the old URL’s signals to the new destination. Over the next few weeks, Google will re-crawl those URLs, follow the redirects, and remove the attachment pages from its index.
Related reads: