Search engines judge a site partly by the pages it offers them. If half the URLs on your site are near-empty pages WordPress made automatically, crawlers spend their time on those instead of your posts, and your real pages can end up competing with copies of themselves. None of these pages hurt on their own. Together, on a site with a few years of uploads and tags, they can outnumber your content.
Slim SEO, Yoast, Rank Math and others have settings for most of the pages below. Use those settings rather than adding code, so you don’t end up with two conflicting rules. The snippets here are for sites without one, or for cases the plugin doesn’t cover.
Attachment pages: redirect them
Every file you upload gets its own page showing just that image or PDF. Visitors almost never need it, and it can rank instead of the post the image belongs to.
Since WordPress 6.4, new sites have attachment pages turned off. Sites created before that still have them. This redirects each one to the post the file was uploaded to, or to the homepage if it wasn’t attached to anything:
The redirect is a permanent 301, so search engines move any signals the old pages had to the post and drop the attachment URLs over the following weeks.
Thin archives: noindex them
Date archives, author archives on a site with one author, and tag pages with one or two posts mostly repeat what’s already on your blog page. They’re fine for visitors, so don’t delete them. Tell search engines not to index them, while still following their links to your posts:
It uses WordPress’s own robots API, so there’s one robots tag on the page, not two.
Paginated archives like /blog/page/2/ are how crawlers reach your older posts. Google no longer recommends noindexing them. The snippet leaves them alone on purpose.
Single pages that shouldn’t be found
Some pages exist only for people who’ve just done something: a thank-you page after a form, a download page, a members area. Searchers landing on them directly is confusing at best:
Keep your sitemap clean
Your sitemap is the list of pages you’re asking search engines to index. It should match the decisions above. WordPress’s built-in sitemap at /wp-sitemap.xml lists users, and with them their usernames, by default:
Leave out whole content types you’ve noindexed, such as tags:
And add last-modified dates, so search engines can tell which pages changed and recrawl those first:
An old attachment URL redirects to its post. A date archive’s source contains one robots tag with noindex, follow. Your sitemap no longer lists users or tags, and its entries show a lastmod date.
Then wait, and check
None of this changes search results overnight. Over the next few weeks, Google Search Console’s Pages report should show the redirected and noindexed URLs moving out of the index, and the number of indexed pages getting closer to the number of pages you actually wrote.
Summary
Redirect attachment pages, noindex date archives, single-author pages and near-empty tags, and noindex pages only meant for people who’ve just taken an action. Then make your sitemap match. If you use an SEO plugin, make these changes in its settings instead.
Check your understanding
Was this helpful?
Sorry about that. What was missing?
Thanks for your feedback!

