Changes between Version 2 and Version 3 of Ticket #57913, comment 68
- Timestamp:
- 11/08/2023 02:52:41 PM (17 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #57913, comment 68
v2 v3 1 1 Hey! I'm an author of a plugin [https://wordpress.org/plugins/disable-media-pages/ Disable Media Pages] which has provided this functionality in previous WordPress versions. I'm trying to figure out what's the best way forward for the plugin since WordPress 6.4 as this functionality is now built into the core. 2 2 3 While testing 6.4, I noticed that even if `attachment_pages_enabled` is set to `0` the redirection only kicks in for logged-in users. For anonymous users, the attachment page is still displayed. It seems this is because read_postcapability [https://github.com/WordPress/WordPress/blob/e2d61d78ede843c2d05f44a4e15f30a57fb47d95/wp-includes/canonical.php#L553C11-L553C11 is checked before] the redirection is performed. Anonymous users don't have any capabilities so the redirection work in this case.3 While testing 6.4, I noticed that even if `attachment_pages_enabled` is set to `0` the redirection only kicks in for logged-in users. For anonymous users, the attachment page is still displayed. It seems this is because `read_post` capability [https://github.com/WordPress/WordPress/blob/e2d61d78ede843c2d05f44a4e15f30a57fb47d95/wp-includes/canonical.php#L553C11-L553C11 is checked before] the redirection is performed. Anonymous users don't have any capabilities so the redirection work in this case. 4 4 5 5 Is this feature intended to work this way or is this an oversight in the implementation?