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: Rank Math settings we recommend (and the modules to leave off) →
Check your own site
Runs this check and the other 186, free, in about 45 seconds.
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.