I have the "video" shortcode and the "tabs" shortcode.

[video]code youtube[/video]

[tab title="text"][/tab]
[tab title="text"][/tab]

If I write the video shortcode into a tab, the "video" shortcode doesn't work... How can I resolve?

2 Answers 2


Make sure to wrap content with do_shortcode()

I'm not sure what the exact function looks like, but for simplicity sake take a look at this example:

function tab_func($atts, $content = null) {
    extract( shortcode_atts( array(
    ), $atts ) );

    $output = '<div class="tab">'.do_shortcode($content).'</div>';

    return $output;
add_shortcode( 'tab', 'tab_func' );

If you take a look at this line

$output = '<div class="tab">'.do_shortcode($content).'</div>';

you'll see that I am wrapping content inside the do_shortcode function which will execute any short code that WordPress finds inside content.

So in your case [tab][video]youtube code[/video][/tab] would now execute the YouTube code inside your tab.

Caveat: In my experience, this only works 1 level deep. If you have another level of short code you need to execute inside of the content, you'll need to make sure that those short code functions also include the do_shortcode function. i.e.:

[tab][video][title]Youtube code[/video][/tab]

In this example, [title] wouldn't display unless the [video] shortcode function also included do_shortcode.

Hope this helps. For more information, take a look at the WordPress documentation for do_shortcode here.

  • Perfect, thanks. I used do_shortcode() in the tabs function and it works.
    – Erfo
    Commented Mar 2, 2014 at 13:53
  • Awesome! Glad it worked out for you :)
    – Ian
    Commented Mar 2, 2014 at 21:33

you need to change the code for the tabs shortcode to include: do_shortcode($content);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.