Attachment Pages Redirect

Makes attachment pages redirects (301 permanent redirect) to post parent if any. If not, redirects (302 temporal redirect) to home page.

Author:Samuel Aguilera (profile at wordpress.org)
WordPress version required:4.8
WordPress version tested:6.3.1
Plugin version:1.1.2
Added to WordPress repository:16-05-2012
Last updated:05-10-2023
Rating, %:98
Rated by:46
Plugin URI:
Total downloads:168 009
Active installs:20 000+
plugin download
Click to start download

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 options page, simply activate it and will do the job.

If you’re happy with the plugin please don’t forget to give it a good rating, it will motivate me to keep sharing and improving this plugin (and others).

Requirements

  • WordPress 4.8 or higher.

FAQ
ChangeLog