WordPress – Shortcode inside shortcode

I try to make a shortcode like

add_shortcode( 'test', 'test' );
function test( $atts, $content = null ) {
    $html = '<div>'.do_shortcode( $content ).'</div>';
    return $html;
}

I try some thing like [test][test]this is test[/test][/test] But that not working.

Read More

enter image description here

How to fix that. Thanks

Related posts

Leave a Reply

1 comment

  1. This is a limitation of the shortcode parser.

    You can check out this entry from the Codex on the shortcode API, where it says:

    However the parser will fail if a shortcode macro is used to enclose
    another macro of the same name:

    [tag-a]   
        [tag-a]    
        [/tag-a] 
     [/tag-a]
    

    This is a limitation of the context-free regexp parser used by do_shortcode() – it is very fast but does not count levels of nesting, so it can’t match each opening tag with its correct closing tag in these cases.