Shortcodes in Widgets

If you have shortcodes that you use in your WordPress blog, you might want to add them in a widget. Although this is not possible, it’s very easy to add support for it. Just add a filter in functions.php.

Now you can add shortcodes in Widgets just as you do in a post or a page.

Code Snippet:

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

Posted in Snippets