Seems simple enough; and, it is … just one line of code will add this functionality:
<?php add_filter( 'widget_text', 'do_shortcode' ); ?>
You could add this to your active theme’s
functions.php file, but the better method would be to use this from a plugin.
Here is a simple, fully functional, code snippet for a plugin to do this:
<?php /* Plugin Name: WPFA Text Widget Shortcode Plugin URI: https://wpfirstaid.com/ Description: Add the ability to use shortcodes in text widgets Version: 1.0 Author: Edward Caissie Author URI: http://edwardcaissie.com/ License: GNU General Public License v2 License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ /** Hook do_shortcode into the text widget */ add_filter( 'widget_text', 'do_shortcode' );