Knowledge Base

Use shortcodes in the text widget

The text & HTML widgets now support shortcodes out of the box in the latest WordPress versions 5.5+, if you are using one of those you can just use the shortcode without doing anything.

On WordPress, by default, shortcodes don’t work in text widgets.

If at some point you need to use a shortcode in the text widget you can enable this functionality by editing the theme’s functions.php file and paste this
 
add_filter('widget_text', 'do_shortcode');
 
at the bottom of the file, if the functions.php ends in a PHP closing tag ?> you paste the code just above it.