I've created my own theme based on a very lean template. My theme is not parsing the [caption]...[/caption] markup to the correct html. It's just showing the text without any markup around it. Here are the relevant observations for my situation:

  • When editing the post it shows [caption]...[/caption] in "Text" mode, and a nice image with caption in "Visual" mode. (as expected)
  • If I view the post (single) it just renders an <img .../> tag and the caption text as plain text.
  • If I view the post (single) in theme TwentyEleven it does render the caption text in a special tag <p class="wp-caption-text">my caption</p>. This is what I'm after in my own theme.

That last observation seems important, and should be my lead to the solution. I've dug through the TwentyEleven theme and found that it renders the content the same way as my own theme does:

<?php the_content(); ?>

I've opened and searched through all the TwentyEleven files, but could not find "wp-caption" anywhere important, or any other clue as to how TwentyEleven gets WordPress to parse the captions and render them with special markup.

I've gone through the functions.php file in TentyEleven because my instinct told me that's where the theme might register a hook or filter for parsing shortcode, but I couldn't find anything.

In addition, I've tried the following:

  • echo apply_filters('the_content', get_the_content());
  • echo do_shortcode(get_the_content());

But neither gives the desired result.

So, the question is: How does a theme get WordPress to parse captions and render them in special markup?

  • Can we see your Theme's functions.php file? Is your Theme doing anything with shortcodes? Is your Theme applying any filters to the_content or the_excerpt? Commented Jan 4, 2013 at 15:24
  • 1
    My theme was indeed unregistering the shortcode support in functions.php. @s_ha_dum's answer details the same cause, you two helped me resolve my problem. Thx a bunch!
    – Jeroen
    Commented Jan 4, 2013 at 15:45
  • Out of curiosity: why were you unregistering shortcode support? Commented Jan 4, 2013 at 17:39
  • @ChipBennet I must admit I don't know: I started based on another theme that did so.
    – Jeroen
    Commented Jan 4, 2013 at 18:09

1 Answer 1


That caption shortcode is built into WordPress. It should generate the same markup for any theme, unless the theme or a plugin has unregistered it and registered a replacement. I don't know if that is the case with your theme or with TwentyEleven. Look for 'img_caption_shortcode' in your theme files, probably functions.php. If your theme is unregistering it, you should see remove_shortcode('img_caption_shortcode'); somewhere.

The CSS, and hence the appearance of the processed shortcode, will almost certainly vary theme to theme.

  • The possibility that TwentyEleven doesn't (have to) do anything for shortcode to work, and that my own theme was actively un-registering the shortcode hadn't crossed my mind yet. This solved my problem. Thanks a bunch!
    – Jeroen
    Commented Jan 4, 2013 at 15:42

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.