[wp-trac] [WordPress Trac] #57913: Attachment pages need to have an "on" toggle
WordPress Trac
noreply at wordpress.org
Thu Mar 16 23:49:24 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 manfcarlo):
Replying to [comment:21 azaozz]:
> 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
> }}}
I don't like the idea of "negative" `add_theme_support` settings.
Why not keep it as a positive setting but apply it through core if the
option is set? Then themes/plugins can remove it again using
`remove_theme_support` instead of needing to save to the option.
{{{
if ( get_option( 'wp_attachment_pages_enabled' ) ) {
add_theme_support( 'attachment-pages' );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57913#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list