Display any shortcode in widget, easy way to display shortcode in text widget without plugin, simple wordpress code, just one line.

How To Display Shortcode In Widget

Using widget_text filter and do_shortcode function, we will display shortcode in widget without wordpress plugins, your shortcode will be display in Text Widget only.

Code

Copy code and paste it in your functions.php file, code:

add_filter('widget_text', 'do_shortcode'); // do shortcode in text widget

Usage

After copy code and paste it in functions.php file, go to Appearance > Widgets, and use “Text” widget, in “Content” field, enter shortcode to display it, for example enter contact form 7 shortcode, will be display contact form in widget.

Example

shortcode in widget