[wp-trac] [WordPress Trac] #24283: is_active_widget() incorrect logic
WordPress Trac
noreply at wordpress.org
Wed Jul 10 14:52:22 UTC 2024
#24283: is_active_widget() incorrect logic
--------------------------+---------------------
Reporter: valllabh | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone:
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
--------------------------+---------------------
Comment (by gingerbrad):
below script would be helpful:
function is_active_widget_extended( $widget_id ) {
global $wp_registered_widgets;
foreach ( $wp_registered_widgets as $widget ) {
if ( $widget_id == $widget['id'] && is_active_widget( false,
false, $widget['id'], true ) ) {
return true;
}
}
ob_start();
the_widget( $widget_id );
$widget_output = ob_get_clean();
if ( ! empty( $widget_output ) ) {
return true;
}
return false;
}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24283#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list