I am working on a project where the admin can enter text that will be presented in a custom template. Once the text is written it is saved to the dB then pulled out and presented when needed.

The problem is that the theme we are using uses shortcodes for some of the design elements. So when the shortcodes are used in this text, and the text is 'echoed' back, the shortcodes are ignored.

Is there someway to pre-process the text so WP will insert the shortcodes?

These shortcodes are not mine, they are from the theme, so the text needs to recognize and activate these shortcodes.


You can run the text through do_shortcode:

echo do_shortcode( $your_text_with_shortcodes );

or you can apply the_content filters to the text, which does the same thing as above along with some additional formatting goodies, like auto paragraphs and texturize:

echo apply_filters('the_content', $your_text_with_shortcodes);
  • Thanks. I knew about the 'do_shortcode' but I thought that was for individual shortcodes. Mar 19 '15 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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