I have created a dashboard widget and this widget will show content which i'll add from an specific page. So, i created a option page and made a textarea field with wordpress editor.

wp_editor(html_entity_decode(stripcslashes($widget_content)), 'widget_wp_content');

But when i am calling this field value in widget area than its giving correct image as image not image html. But for caption its showing caption shortcode.like

 [caption id="attachment_25613" align="alignnone" width="200"]image display and caption_content[/caption].

I am using code to print value is

echo  html_entity_decode(stripslashes($val['content']));


2 Answers 2


You need to run it through do_shortcode(). do_shortcode() 'runs' any shortcodes in text passed to it:

echo do_shortcode( html_entity_decode( stripslashes( $val['content'] ) ) );
  • yes, i just corrected that to echo do_shortcode(wpautop(stripslashes($options['content']))) Oct 22, 2017 at 21:25
  • Your answer is working. Thanks Jun 20, 2022 at 16:18

I think you need to enable shortcode in your widget ?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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