[wp-trac] [WordPress Trac] #53771: What about an equivalent of `is_active_widget()` for Widget Blocks ?
WordPress Trac
noreply at wordpress.org
Sat Jul 24 13:13:26 UTC 2021
#53771: What about an equivalent of `is_active_widget()` for Widget Blocks ?
-------------------------+-----------------------------
Reporter: imath | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version:
Severity: normal | Keywords: has-patch
Focuses: |
-------------------------+-----------------------------
This doesn't seem to exist in WordPress Core and I haven't found a ticket
asking about this. (I hope I haven't missed one, sorry if I did).
`is_active_widget()` can't be used because all Block are added into the
same Widget: `WP_Widget_Block`.
For BuddyPress when migrating our Legacy Widgets to Widget Blocks, I had 2
cases where some output wasn't made if a widget was active into a sidebar
(Sitewide notice, and BP Primary Nav). To satisfy our need we are using
[https://buddypress.trac.wordpress.org/browser/tags/9.0.0/src/bp-core/bp-
core-template.php#L3869 this function] to check if a block or a widget is
active into a Sidebar Widgets.
I thought maybe it can be interested to have an equivalent of
`is_active_widget()` into WordPress. I quickly put up a patch about it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53771>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list