Using shortcode content with nested shortcode

You don’t have to use do_shortcode inside your shortcode callback function.

But if you don’t do this, then you won’t be able to nest shortcodes, so other shortcodes added on the site won’t work inside it.

Let’s say your shortcode callback looks like this:

function a_shortcode($atts = [], $content = null) {

    //use content here, parse [b]something[/b] as string and do whatever
    $result="<div>". $content .'</div>';
    return $result;

}

So it takes given content and wraps it in div. Because it doesn’t run do_shortcode, all shortcodes placed in content will be ignored and they won’t be parsed.

Sometimes it’s OK – if you write a shortcode to display a button, you (most probably) don’t won’t to be able to place an advanced shortcode as label of that button.

Sometimes it’s not OK – if you write a shortcode for columns, you want to be able to place other shortcodes (like button) inside that column…