Home » Blog » Using ShortCodes in WordPress Text Widgets

Using ShortCodes in WordPress Text Widgets

Nov 24, 2011   //   by David   //   Blog, Coding  //  No Comments

Shortcodes can be incredibly useful in WordPress posts but have you ever tried to put them into a text widget? Not much luck there when all you get is the text showing the [shortcode] you entered.

Well, there is a quick and easy solution. Just add this to your functions.php file:

add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');

Source: using shortcodes everywhere

Simple. Now you’ll be able to use your cool shortcodes within text widgets.

Leave a comment