I think the title of my question says it all.
When creating a shortcode, I’ve seen some people do do_shortcode($content)
instead of $content
.
What is the difference?
Another thing, let’s say I have a shortcode [hello]World[/hello]
. Wouldn’t returning do_shortcode($content)
result in do_shortcode('World')
?
From the codex, the examples given are as such, do_shortcode('[hello]')
So what will returning do_shortcode($content)
interpret? (in the case of [hello]
)
Any practical examples or clear explanations would be greatly appreciated. Thanks.
This is useful if you donât know if the
$content
contains unknown shortcodes.Example
Your shortcode
Now your user might write something like this:
You have no idea what
[bar]
does or that it even exists. So you let WordPress handle that perdo_shortcode()
. If you donât do that,[bar]
will not be parsed as shortcode and showed as is instead.