Allowing Shortcode in sidebar widget

By default, WordPress won’t allow you to add shortcode in sidebar widget. There are several plugins that requires shortcode to be added to post, or do the hard-coding jobs to do them manually on template. And its frustrating when you have a dynamic sidebar and you want a widget that runs on shortcode.

So, a line of code added to functions.php of your theme can make a difference and you can just add shortcode like in posts.

Add

add_filter('widget_text', 'do_shortcode');

to functions.php file of the theme and after then its all possible.

Happy Widgetizing!!

One thought on “Allowing Shortcode in sidebar widget”

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>