WordPress Snippets at WPcustoms

Enable shortcodes in text widgets

This single line enables the shortcode functions in widgets. By default WordPress prints the [shortcode] tag and will not render it. do_shortcode is the template function to display a shortcode in a template file so we just need to add that to our widget_text filter.

 * Snippet Name: Enable shortcodes in text widgets
 * Snippet URL: https://wpcustoms.net/snippets/enable-shortcodes-in-text-widgets/
   add_filter('widget_text', 'do_shortcode', 11);