I have a sidebar in WooCommerce showing sub categories with the “Product categories” widget. However when a category has no subcategories I wan’t the sidebar to be hidden.
is_active_sidebar is only checking if the sidebar has widgets and not if the current page you’re on has widget content. Therefor the sidebar is still shown, because it does contain a widget, but there are no content to be shown on a category without sub categories.
How can I check if any of the sidebar widgets have content on the current page, so that I can use that conditional to hide the sidebar, if there is no content to be shown?
Read more here:: Show only sidebar if widgets have content on the current page