[wp-trac] [WordPress Trac] #57913: Attachment pages need to have an "on" toggle
WordPress Trac
noreply at wordpress.org
Thu Mar 16 23:16:47 UTC 2023
#57913: Attachment pages need to have an "on" toggle
-----------------------------------+------------------------------
Reporter: joostdevalk | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion has-patch | Focuses:
-----------------------------------+------------------------------
Comment (by azaozz):
Replying to [comment:18 SergeyBiryukov]:
> Yeah, that could be implemented if that's the consensus here:
> * Keep the upgrade routine from the previous iteration of the PR, which
would set an option, e.g. `wp_attachment_pages_enabled` (to follow the
`link_manager_enabled` precedent), so that existing sites don't need to do
anything to keep the current behavior.
> * For new sites, set the `wp_attachment_pages_enabled` to `0` by
default.
Yep, that's a pretty good way of doing it: existing sites will have the
option set to `true`, new installs will have it set to `false`.
The complication there is that the option overrides the
`add_theme_support` setting. I.e. when an existing site wants to disable
attachment pages, the option will have to be changed to `false` (only
once). This probably won't be a big problem but would need to be
documented well (in the code and on make/core).
The other (simpler?) possibility would be to have a "negative"
`add_theme_support` setting, maybe something like
{{{
add_theme_support( 'disable-attachment-pages' );
...
if ( is_attachment() && current_theme_supports( 'disable-attachment-pages'
) ) {
// redirect
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57913#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list