[wp-trac] [WordPress Trac] #46743: A way to detect whether the current theme supports wp_body_open()
WordPress Trac
noreply at wordpress.org
Mon Apr 15 17:32:32 UTC 2019
#46743: A way to detect whether the current theme supports wp_body_open()
-----------------------------------+---------------------
Reporter: SergeyBiryukov | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.2
Component: Themes | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses:
-----------------------------------+---------------------
Changes (by ramiy):
* keywords: has-patch => has-patch 2nd-opinion
Comment:
Replying to [ticket:46743 SergeyBiryukov]:
> Should we add `body-open` to the list of theme features registered with
[https://developer.wordpress.org/reference/functions/add_theme_support/
add_theme_support()], so that plugin authors could check it with
`current_theme_supports()`?
Not sure we should add a theme features for the new `wp_body_open()`
function.
Why not?
1. We don't register theme features for `wp_head()` and `wp_footer()`.
2. When hooking to the `wp_body_open` action, if the action does not exist
(pre 5.3 versions), it won't do nothing and won't break nothing as the
action does not exist.
3. We should educate theme developers how to use `wp_body_open()` function
(see #46679).
4. Besides, we can't add theme features for every new function.
If plugin developers want to check if the `wp_body_open()` function exist,
they can check it using:
`if ( ! function_exists( 'wp_body_open' ) ) { ... }`
The same way the default functions do that in ticket #46679.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46743#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list