Redirect attachment pages or return a 404 error for them based on the parent post status.
As of April 2026, Attachment Pages Redirect is a WordPress 301 plugin with 20K+ active installations and a 4.9/5 rating from 47 reviews. It has been downloaded 181K+ times in total. Requires WordPress 4.8+ and PHP 5.6+. Available on WordPress.org since 2012. Recently updated within the last 3 months. Downloads are down 19% this week. Top alternative: Redirection.
There are three possible scenarios where this plugin does something. In all cases, the attachment page must exists, the plugin will not run for deleted attachments:
A) A visitor lands on an attachment page and the parent post is available (not in trash or deleted). A 301 redirect will be issued to redirect the visitor to the parent post.
B) A visitor lands on an attachment page and the parent post was already deleted from trash. A 302 redirect is issued to home page (this can be changed to 301 if you want, see FAQ for more details).
C) A visitor lands on an attachment page and the parent post is in trash, therefore not available for the visitor. It returns a 404 error code to prevent endless redirection loop in old WP releases and redirecting to trashed/not available posts.
There is no op…
This plugin has been such a big help for my website. Before, people clicking an image they found in Google Images would be taken to the image’s attachment page with no other context. Now they are taken to the page we want them to go to, leading to better engagement with our site.
Exactly what I needed. Thanks!
I didn’t want any attachment pages to be accessed by visitors, then found this plugin that does the job by just installing and activating. Thanks!
Plugin is not working anymore
thanks man. You save a bigger work here. Thanks for this.
| WordPress | 4.8+ requiredTested up to 6.9.4 |
| PHP | 5.6+ required |
Plugin data sourced from WordPress.org. Analysis and metrics by PluginSift.