[wp-trac] [WordPress Trac] #57913: Attachment pages need to have an "on" toggle

WordPress Trac noreply at wordpress.org
Wed Nov 8 14:50:42 UTC 2023


#57913: Attachment pages need to have an "on" toggle
---------------------------------------------+-----------------------------
 Reporter:  joostdevalk                      |       Owner:  SergeyBiryukov
     Type:  enhancement                      |      Status:  closed
 Priority:  normal                           |   Milestone:  6.4
Component:  Media                            |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  add-to-field-guide has-dev-note  |     Focuses:
---------------------------------------------+-----------------------------

Comment (by joppuyo):

 Hey! I'm an author of a plugin [https://wordpress.org/plugins/disable-
 media-pages/ Disable Media Pages] which entire point is to provide this
 functionality. 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.

 While testing 6.4, I noticed that even if `attachment_pages_enabled` is
 set to `1` 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.

 Is this feature intended to work this way or is this an oversight in the
 implementation?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57913#comment:68>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list