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

Is this the best way to enable nested shortcodes?:

add_filter( 'the_content', 'do_shortcode' );

I keep finding mixed results and want to be sure I won't break anything else!

share|improve this question
up vote 2 down vote accepted


Everything you need to know about nested shortcodes in WP

share|improve this answer
That mentions "provided their handler functions support it by recursively calling do_shortcode()" - So, doing it like above wouldn't be the way to go? – hhins Nov 8 '11 at 16:31
Maybe a more appropriate question would be, would setting that above to the default priority (10) cause issues I'm unaware of? – hhins Nov 8 '11 at 16:44
The line of code you have posted is useless. You are adding the do_shortcode function to the filter the_content. WordPress already does that automatically. Applying it again wont make things recursive. As the codex says: "provided their handler functions support it by recursively calling do_shortcode()" – Brady Nov 8 '11 at 17:22
What shortcode are you nesting? – Brady Nov 8 '11 at 17:24
It's just a handful of different column shortcodes, they don't rely on do_shortcode($content) in the shortcodes. It does work with the filter changed to priority 10 but I think I'll just rewrite them to use do_shortcode($content) as it states. I appreciate your quick replies. – hhins Nov 8 '11 at 17:37

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.