WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display a specific gallery (without a plugin = WordPress built-in gallery) inside a widget. I tried the shortcode [gallery ids="717"] but that doesn't work. Maybe a workaround could be enabling shortcodes inside widgets? if yes, how do I do that?

share|improve this question
up vote 3 down vote accepted

Widgets don't usually allow shortcodes in them (they treat them as normal text).

What you have to do, is to tell this widget, it should run do_shortcode on it's text. To do it, you can use this snippet:

add_filter('widget_text', 'do_shortcode');

Just place it in your function.php file. Then you can place shortcodes in Text Widget and they will work normally.

share|improve this answer
nice! thanks for the quick answer – jan reimers Jul 1 '13 at 9:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.