Skip to main content
Agency Program Get 2× more leads and save 50% on hosting. Built for agencies ready to grow. Book a call
Attachment Pages Redirect icon

Attachment Pages Redirect

v1.1.2
by Samuel Aguilera · 4.9 (47 reviews)

Redirect attachment pages or return a 404 error for them based on the parent post status.

20K+ active installs Updated Oct 05, 2023 Tested to 6.3.5 Requires PHP 5.6
Try Demo Download
Pre-installed Ready in ~10s No card

About Attachment Pages Redirect

This plugin redirects visitors who land on attachment pages to the parent post. It works in three scenarios, depending on whether the parent post is available or deleted. There is no options page, just activate the plugin and it will do the job.

Frequently asked questions

What happens if a visitor lands on an attachment page and the parent post is available?
The plugin issues a 301 redirect, sending the visitor directly to the parent post. This ensures a seamless user experience by guiding them to the relevant content.
What occurs when a visitor lands on an attachment page and the parent post has been deleted?
A 302 redirect is issued, directing the visitor to the home page. This can be configured to a 301 redirect if preferred, as detailed in the FAQ.
How does the plugin handle attachment pages when the parent post is in the trash?
The plugin returns a 404 error code. This prevents endless redirection loops and avoids redirecting to unavailable or trashed posts.
Does this plugin have an options page for configuration?
No, there is no options page for this plugin. Simply activate it, and it will begin functioning automatically.
What are the WordPress requirements for this plugin?
This plugin requires WordPress version 4.8 or higher to function correctly. Ensure your WordPress installation meets this minimum requirement.

Changelog

1.1.2

  • Changed code for 404 scenario to use the theme’s 404 template if it’s available.

1.1.1

  • 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

  • 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

  • Initial release.

Try other plugins

YITH WooCommerce Wishlist icon

YITH WooCommerce Wishlist

3.9 · 600K+ installs

YITH WooCommerce Wishlist add all Wishlist features to your website. Needs WooCommerce to work. WooCommerce 8.1.x compatible.

Header Footer Code Manager icon

Header Footer Code Manager

4.9 · 600K+ installs

Easily add tracking code snippets, conversion pixels, or other scripts required by third party services for analytics, marketing,…