I asked this elsewhere but I'm not getting very far with the answers, so thought I'd try here as it's specific to Wordpress. I have this shortcode:

function reytab($atts, $content = null) {
    extract(shortcode_atts(array('title' => '#'), $atts));
    return '<div class="tab">'.
        '<h2 class="reytab">'.
        '<div class="tab-content">'.
    '</div><!-- End div.tab -->';
add_shortcode('reytab', 'reytab');

And I'm calling it in my wysiwyg editor in Wordpress like this:

Shortcode in wysiwyg editor

This is the markup that's generated from my shortcode and as you can see the $content is being rendered outside of the .tab-content div:

<div class="tab">
    <h2 class="reytab">Title</h2>
    <div class="tab-content"></div>
...content appears here...[\reytab]

You can see that [/reytab] is being rendered as part of the $content, so I'm assuming my issue is something to do with either the shortcode, a conflict with a plugin (which it's not as I've deactivated all of them to test that) or a conflict in my theme (which I'm also assuming it's not as I tried this with TwentyEleven - although, as I'm using a child theme that relies on TwentyEleven, it's still possible it's a conflict I guess).

Can anyone offer some advice on what I can try? I'm really lost as to what I can check.



  • 3
    What happens if you change [\reytab] to [/reytab]? I think your slash is just backwards and things are trying to compensate for the mismatched elements caused by that.
    – mor7ifer
    Commented Feb 29, 2012 at 19:54
  • @m0r7if3r You are amazing. I can't believe it was that simple, I feel like such a d**k. Please provide this as your answer and I'll credit you with solving my problem.
    – Osu
    Commented Feb 29, 2012 at 20:21
  • Hah, we all have those days. Solution submitted.
    – mor7ifer
    Commented Feb 29, 2012 at 20:39

1 Answer 1


Your code is fine, the issue is in your shortcode. If you look around line 200 of /wp-includes/shortcodes.php, you can see that only / is supported for the close tag, not \. If you change [\reytab] to [/reytab] it will work!

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.