How to stop WordPress attachment pages from being indexed
WordPress creates a page for every uploaded image. Redirect them to the file or the parent post so they do not dilute the index.
Step by step, with screenshots: WordPress attachment pages: why they get indexed, how to stop it →
Check your own site
Runs this check and the other 192, free, in about 45 seconds.
Or run only this check with the free WordPress health check.
What it is
An attachment page is a separate page WordPress creates for every file you upload, such as example.com/product-name/photo-1/, showing just that image or file with your theme around it. Before WordPress 6.4 every site had them; since 6.4, new installs redirect them to the file, but older sites keep them.
They hold almost no content, so hundreds of them in Google's index dilute your site with thin pages and can outrank the post the image belongs to in image searches. SEO plugins exist largely to switch them off.
OK looks like this: attachment URLs redirect to the file itself or to the parent post, and they are not listed in your sitemap. getReport counts attachment URLs in the sitemap and warns when they are indexable.
What a passing site looks like
- Attachment pages are not exposed to search engineswarning · −1 ptseffort S
WordPress attachment pages
Why it matters. WordPress creates a bare page for every uploaded image. Hundreds of them in the index dilute the site with pages that hold nothing but a picture.
- In Yoast SEO, under Settings, Advanced, Media pages, enable the redirect of attachment URLs to the file itself; in Rank Math set Media to noindex or redirect.
- Without an SEO plugin, add a redirect from attachment pages to the parent post in your theme or a redirect plugin.
Questions people ask
What is an attachment page in WordPress?
It is an automatically generated page for each uploaded media file, showing the file with its title, caption and description inside your theme. WordPress links to it when you choose "Link to: Attachment page" for an image. For most sites these pages add nothing and are best redirected.
How do you disable attachment pages in WordPress?
In Yoast SEO, turn media pages off under Settings → Advanced → Media pages, which redirects them to the file. In Rank Math, enable Redirect Attachments under General Settings → Links. Sites installed on WordPress 6.4 or later already redirect them by default. Afterwards check that the sitemap no longer lists them.
Are WordPress attachment pages bad for SEO?
They are not harmful one at a time, but in bulk they add many near-empty pages to Google's index and can compete with your real posts. Google also has to spend crawls on them. Redirecting them to the file or parent post removes the problem and keeps any links they had.