If you make use of shortcodes and widgets on your WordPress site (which is probably most of us), you might find that they don’t particularly work well together straight out of the box. For example, including a shortcode in a Text widget does not execute the shortcode itself and just displays the shortcode as text (instead of the actual output of said shortcode).
Luckily, it’s as simple as adding one line to your function.php file to get this working as you’d hope. Check it out:
// Enable shortcodes for use in text widgets - RobCallaghan.co.uk
add_filter('widget_text','do_shortcode');
The filter above essentially adds an extra step for WordPress to execute all of the shortcodes within the text widget and return the output.
I hope this helps you. Let me know if you have any questions in the comments below!