Have you ever wanted to use a WordPress shortcode in a text widget, or have you ever attempted to do so with undesired results? I have, and wanted to re-share a common little code snippet that allows you to use a WordPress shortcode from your theme or plugin within a text widget!
To enable shortcodes in a text widget on your website add the do_shortcode filter call to the widget_text hook within into your theme’s function.php file, as shown below:
Note: The only widget that calls the widget_text hook, is the text widget. This code snippet will not affect any other widgets in your library, only the WordPress Text widget.