Add a class to a dynamic sidebar’s wrapper

What if the theme has other stuff added and/or styled their sidebar for all the other core widgets and only works with display:block for example, or they set it to flex column where you might expect flex row / vice versa. I would suggest you add a wrapper to your widget content, if your widget content relies on a wrapper to be set a certain way, so you prevent breaking other widget’s displays or display of the sidebar from theme to theme. Afterall there’s no guarantee there that they even set a wrapper around the sidebar call like is shown above. You also don’t have control over other plugins that might try to do this same thing – so then you would end up with incompatibility complaints.

Alternatively if you think this is really the best way to handle it for your particular situation, you could try using dynamic_sidebar_before and dynamic_sidebar_after hooks to add your own wrapper around dynamic_sidebar calls.