5

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!

5

http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes

Everything you need to know about nested shortcodes in WP

6
  • 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
  • 1
    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()"
    – Scott
    Nov 8 '11 at 17:22
  • What shortcode are you nesting?
    – Scott
    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 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.