WordPress: Shortcode in Text Widget

By default, WordPress doesn’t parse WordPress or other 3rd party shortcodes in text widgets. I often see people putting shortcodes into text widgets and wonder why nothing is displayed.

To parse and output shortcodes in text widgets, you need to modify your WordPress theme and put the following code into the “functions.php” file of the theme.

<?php add_filter('widget_text', 'do_shortcode'); ?>

You’re simply hooking onto the widget_text filter hook of WordPress which passes and returns the content through the function you specify. In this case you’re sending the widget_text content to do_shortcode() which is a WordPress core function that parses shortcodes in a string/content.

And that’s it, you can now put shortcodes into WordPress text widgets.


  1. By Adrian

  2. By Al

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

%d bloggers like this: