NEWOur agents now make the SEO fixes on your site and check what worked →

WordPress Attachment Pages: Why They Hurt SEO

/

WordPress used to create a separate page for every file you uploaded, and those thin one-image pages could get indexed by Google. WordPress 6.4 turned them off for new sites only, so any site created before November 2023 likely still has them.

Free spreadsheet

Get the WordPress SEO Checklist

We email you the WordPress SEO checklist now, then 3 short emails on using it. Unsubscribe in one click. We never sell your data. Privacy

Switch on the redirect in Yoast (Settings > Advanced > Media pages) or Rank Math (General Settings > Links > Redirect Attachments), or set the wp_attachment_pages_enabled option to 0. This is one of the 70 checks in our WordPress SEO checklist.

What an Attachment Page Is

When you upload an image, WordPress stores the file (for example /wp-content/uploads/2024/05/tent.jpg) and, on older setups, also creates a page for it, such as /tent/ or /?attachment_id=123. That page usually holds the image, a title and little else.

For SEO that is a problem:

  • Hundreds of near-empty pages compete for crawl attention with your real pages.
  • Google may show the attachment page instead of the post that uses the image.
  • Visitors who land there see one picture and leave.

Yoast's own help page calls these URLs not useful in almost every setup (Yoast, Media pages).

What Changed in WordPress 6.4

WordPress 6.4 (November 2023) added an option called wp_attachment_pages_enabled (make.wordpress.org, October 16, 2023):

SiteValue after 6.4What visitors get at an attachment URL
New install on 6.4 or later0Redirect to the file itself
Existing site upgraded to 6.41The old attachment page, unchanged

So an upgrade did not fix older sites. If your site is older than 6.4, assume the pages are still there until you check.

How to Check If Your Site Still Has Them

  1. Open the Media Library, click any image and copy its "attachment page" link, or try yoursite.com/?attachment_id= followed by a media ID.
  2. If you land on a page with your theme's header and one image, the pages are on. If you land on the image file or the parent post, they are off.
  3. In Search Console, open Performance > Search results > Pages and filter page URLs for attachment or for slugs that match image names. Any clicks or impressions there mean Google has them indexed.
  4. Check your sitemap index for an attachment or media sitemap. It should not be there.

How to Turn Them Off

WherePathNotes
Yoast SEOYoast SEO > Settings > Advanced > Media pagesLeave "Enable media pages" off. Off redirects each attachment URL to the file
Rank MathRank Math SEO > General Settings > Links > Redirect AttachmentsNeeds Advanced Mode. Redirects to the parent post; "Redirect Orphan Attachments" sends unattached files to a URL you choose, the homepage by default
No pluginwp-admin/options.php, find wp_attachment_pages_enabled, set 0Or WP-CLI: wp option set wp_attachment_pages_enabled 0
The SEO FrameworkFree "Origin" extension in Extension ManagerRedirects attachment pages to the file

Sources: Rank Math general settings, Yoast Media pages, make.wordpress.org.

Which target is better, the file or the parent post? Rank Math argues for the post, because it passes any links the attachment page earned to a real page. Yoast and WordPress core send visitors to the file. Both remove the thin page. If some attachment URLs have real backlinks, redirecting to the post keeps more value.

Cleaning Up Attachment URLs Already in Google

Turning the setting on is most of the work. Then:

  1. Let Google recrawl. Redirected URLs drop out of the index as Google crawls them again. This can take weeks on a large site.
  2. Do not block them in robots.txt. Google has to crawl the old URL to see the redirect.
  3. Remove them from your sitemap. Your SEO plugin does this once media pages are off. Resubmit the sitemap in Search Console.
  4. Spot check a few with URL Inspection. The result should show the redirect target as the page Google picked.
  5. Use the Removals tool only for urgent cases. It hides a URL for about six months; it does not delete it (Google, Removals tool).

Your images stay in Google Images. Image search indexes the file URL, which is not affected.

When to Keep Attachment Pages

A few sites use them on purpose: photo portfolios where each image has a long caption, or download libraries where each file page has a description. If that is you, keep them on, write real text on each, and treat them like any other page. Everyone else should turn them off.

How to Use This with an AI Assistant

Connect SEOmatic at https://seomatic.ai/mcp and ask: "Use gsc_performance top_pages for mysite.com over the last 90 days and list any URLs that look like WordPress attachment pages (image-name slugs or ?attachment_id=). Then check five of them with gsc_indexing inspect." This needs a free SEOmatic sign-in; the plugin setting itself stays a manual change.

Let the Agents Do This on Your WordPress Site

SEOmatic's AI agents connect to WordPress, read your own Google Search Console data, and make the fixes from this checklist directly on your site:

  • Rewrite SEO titles and meta descriptions, including through Yoast or Rank Math
  • Add internal links and schema where they are missing
  • Set up redirects and fix pages blocked from Google

Each change can wait for your approval, one click undoes it, and the agents check it against how the rest of your site did. What they can change depends on your platform, and you see the full list before anything runs.

14-Day Trial for $1, credited to your first payment.

Frequently Asked Questions

digi-business-uk

Each local area page used to take us half a day to create and optimize.


With SEOmatic, we can create hundreds of pages in the same time, which helps our clients make the best use of their budget.


It's transformed how we deliver scalable SEO solutions.

will-hawkins

Will Hawkins

Marketing Director, Digi-Business UK

Give Your Site an SEO Team

Agents read your Search Console data, do the work, and prove what actually moved. You decide what ships.

  • You decide what ships
  • Verified live
  • One-click rollback

14-Day Trial for $1, credited to your first payment.