[wp-trac] [WordPress Trac] #57913: Attachment pages need to have an "on" toggle
WordPress Trac
noreply at wordpress.org
Mon Mar 20 21:12:58 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 needs-docs | Focuses:
----------------------------------------------+----------------------------
Changes (by azaozz):
* keywords: 2nd-opinion has-patch => 2nd-opinion has-patch needs-docs
Comment:
Replying to [comment:23 aristath]:
> 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' );
> }
> }}}
@aristath @manfcarlo Yep, this would work. Looking a bit more, it is very
similar to what Sergey was talking about in
[https://core.trac.wordpress.org/ticket/57913?replyto=23#comment:18
comment 18]. Chances are plugins and themes would probably do
`remove_theme_support( 'attachment-pages' )` on every page load as that
would be most compatible (but will be one more function call).
This also makes the "theme_support" part somewhat useless as it will be
dependent on the option. So maybe WP can just use the
`wp_attachment_pages_enabled` option and set it to `true` for existing
sites and `false` for new installs. Then everybody will be able to update
it as needed (hopefully just once) on plugin/theme activation.
Would still be very nice to document this option as well as possible.
Actually not sure how that could be done so the inline/docblock docs would
show at https://developer.wordpress.org/reference/, or if that's even
possible.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57913#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list