Originally published - 07/24/2014 Last updated - 11/23/2017
The Allow Shortcode in Text Widgets WordPress plugin has only one very simple task… Allow shortcodes to be used in default WordPress Text widgets.
How is Allow Shortcode in Text Widgets Useful?
In many cases, a website owner need to use the shortcode generated by a plugin in their website’s sidebar, but when they input the shortcode, only the shortcode itself is displayed as text… Not the intended function of the shortcode.
This happens when the active website theme does enable the ability to post shortcodes in the text widget.
The Allow Shortcode in Text Widgets WordPress plugin simply enables this function.
Enable Shortcode in Text Widgets via functions.php
If you’re a subscriber of the “don’t use too many plugins on your WordPress website” myth, you can add the following snippet to your theme’s functions.php file.
// Enable shortcodes in text widgets add_filter('widget_text','do_shortcode');
That said, adding this type of code to your theme’s functions.php file. Realistically, your theme’s functions.php should only contain code that pertains code specific to your currently active WordPress theme. If you change your website’s theme, you will lose all functionality that you’ve added to the functions.php file. To keep the functionality, you have to remember to copy it over to your new theme’s functions.php file.
Create a Must Use WordPress Plugin for your Code Snippets
The best method to allow shortcode in your WordPress text widgets is to create a simple must use WordPress plugin using the above snippet of code. This method is preferred because a mu-plugin is always on and if you change WordPress themes on your website, you will not have to remember to transfer the snippet of code to your new theme’s functions.php file.
Benefits of the Allow Shortcode in Text Widgets WordPress Plugin
I “developed” this simple WordPress plugin so beginner website owners won’t need to edit or create any files on their website – or the need to remember to transfer the code snippet to new WordPress themes. NOTE – This plugin will not conflict with your new theme, if the theme developer has enabled shortcode in text widgets in the theme’s functions.php
Download Allow Shortcode in Text Widgets – This plugin hasn’t been updated since 2014, but it still works as expected.
Enjoy it, if you need it!