The condition is i have to check the id of active widgets of one sidebar and hide some widgets based on id of the listed widgets.Any ideas ...
1 Answer
Despite what you say is_active_widget
does work on custom widgets as well. You may just have trouble locating its ID. To help you, here's a snippet that will show the ID of a widget on the widget admin.
add_action('in_widget_form', 'wpse202950_get_widget_id');
function wpse202950_get_widget_id($widget_instance) {
if ($widget_instance->number=="__i__"){
echo '<p class="widget-id-message">' . __('Save the widget to get its ID','textdomain') . '</p>';
}
else {
echo '<p class="widget-id-message">' . __('The widget ID is:','textdomain') . ' ' . $widget_instance->id . '</p>';
}
}