[wp-trac] [WordPress Trac] #57913: Attachment pages need to have an "on" toggle
WordPress Trac
noreply at wordpress.org
Mon Mar 20 07:25:15 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 aristath):
> 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).
We could use the option to internally set theme_support, and then in our
checks, use the `current_theme_supports()` function... So something like
this:
{{{#!php
if ( get_option( 'wp_attachment_pages_enabled' ) {
add_theme_support( 'attachment-pages' );
}
}}}
This way, existing sites will have the feature enabled by default.
This will allow existing sites to opt-out using `remove_theme_support(
'attachment-pages' )`, and new sites will be able to opt-in using
`add_theme_support( 'attachment-pages' );`
What do you think?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57913#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list