Attachment Pages Redirect

Wordpress Plugin
Download latest - 1.1.2

Developers

samuelaguilera

Download Stats

Today 69
Yesterday 75
Last Week 517
All Time 43,697


There are three possible scenarios where this plugin does something:

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.

Releases (4 )

Version Release Date Change Log
1.1.2 2020-04-26
  • Changed code for 404 scenario to use the theme's 404 template if it's available.
1.1.1 2019-07-28
  • Minor changes to make code 100% compliant with WordPress Coding Standards. This doesn't means any change in the plugin functionality, it's just code cosmetic.
1.1 2018-01-18
  • Minor coding standards improvements.
  • Added ATTACHMENT_REDIRECT_CODE and ORPHAN_ATTACHMENT_REDIRECT_CODE constants to allow change the HTTP redirection codes (e.g. change 302 to 301 for orphan attachments)
  • Prevent endless redirection loop in old WP releases and redirecting to trashed/not available posts if an attachment page is visited when parent post is in trash. Returning a 404 error in this case.
1.0 2017-03-05
  • Initial release.