How to allow shortcodes to work in WordPress text widgets

If you are using shortcodes in your WordPress site, you may want to make it so they will work in text widgets. This can be especially useful if you are using a plugin that produces a shortcode to call the plugin and want to display it in a sidebar or other widget area. Just add this WordPress Code Snippet to the functions.php file in your current WordPress theme in order to make it so your shortcodes will work when placed in a text widget.

/**
 * Allow shortcodes in Text Widgets
 *
 * @author WPSnacks.com
 * @link http://www.wpsnacks.com
 */
add_filter('widget_text', 'do_shortcode');

That’s it, now your shortcodes can be called inside text widgets and work correctly. Hope this helps, enjoy!

   Related Sponsored Links

Disclaimer: The information contained in this website is for general information purposes only and in no event will this site or its owners be liable for any losses or damages associated with your use of our site or content. Click here to see our full Disclaimer.

Leave a Comment

*