public static function get_widget_count($sidebar_id)
    {
        global $_wp_sidebars_widgets;

        // If not front page, the global is empty so set it another way.
        if (empty($_wp_sidebars_widgets)) {
            $_wp_sidebars_widgets = \get_option('sidebars_widgets', []);
        }

        // if our sidebar exists, return count.
        if (isset($_wp_sidebars_widgets[ $sidebar_id ])) {
            return \count($_wp_sidebars_widgets[ $sidebar_id ]);
        }

        return 0;
    }