Support » Fixing WordPress » Caption broken in new 3.4 posts

Viewing 12 replies - 31 through 42 (of 42 total)
  • andidas thank you so much for chasing this down and providing a very clear fix.

    @andrew Nacin, you asked for specific plug-ins which seemed to break the new caption code. When I deactivated this Pinterest plug-in, my captions began working again:

    I’m using Site5’s WordPress Anniversary Theme (

    For those who say Thesis has issued a patch or fix for this – is it something I need to hunt down? I’m showing no Thesis updates available, yet I’m still having the problem. Captions do not appear in a frame around the image, they appear off to the right, in the same font as the the paragraph, and the image is not framed. For me, it also occurred after the WordPress update everyone has referenced, but it also went back and changed previously published posts, not just new ones going forward. Very frustrating. Any help would be greatly appreciated!
    (scroll to the Minka Kelly and Skeletor images – the sentence NEXT to the pic is supposed to be the caption)

    OK, so the links I provided above are now bad examples because I used the manual fix from earlier in this thread to correct the images in that post. But PLEASE tell me there is a fix that will allow me to not have to go in to all 300+ posts on my site and fix the captions.


    You need to install Thesis 1.8.5 or later for this problem to get fixed. Thesis does not automatically tell you that an update is available, nor does it apply them via one-click like other themes that are hosted on Head over to and follow the instructions to upgrade.

    My site is running Thesis 1.8.5, here’s a link with working captions:

    P2 Theme gets an upgrade: say hello to Custom Menus and To-Do List Support

    I have de/activated each of my plugins one by one, and doing so does not resolve the caption conflict – captions are still being rendered incorrectly, with all the plugins deactivated.

    I have also (with plugins deactivated) implemented the functions hook provided by andidas here, and still the captions are not displaying correctly.

    I use a completely custom-theme, hand-coded, so any advice on correcting this WordPress 3.4+ implementation is appreciated. Thanks.



    In my completely custom-theme, hand-coded, I removed this code in the functions.php:

     * The TwentyTen Five Caption shortcode.
     * added by Richard Shepherd to include HTML5 goodness
     * The supported attributes for the shortcode are 'id', 'align', 'width', and
     * 'caption'.
     * @since TwentyTen Five 1.0
    add_shortcode('wp_caption', 'twentyten_img_caption_shortcode');
    add_shortcode('caption', 'twentyten_img_caption_shortcode');
     * Prints HTML with meta information for the current post—date/time and author.
     * @since TwentyTen Five 1.0
    function twentyten_img_caption_shortcode($attr, $content = null) {
    		'id'	=> '',
    		'align'	=> 'alignnone',
    		'width'	=> '',
    		'caption' => ''
    	), $attr));
    	if ( 1 > (int) $width || empty($caption) )
    		return $content;
    if ( $id ) $idtag = 'id="' . esc_attr($id) . '" ';
    $align = 'class="' . esc_attr($align) . '" ';
      return '<figure ' . $idtag . $align . 'aria-describedby="figcaption_' . $id . '" style="width: ' . (10 + (int) $width) . 'px">'
      . do_shortcode( $content ) . '<figcaption id="figcaption_' . $id . '">' . $caption . '</figcaption></figure>';

    .. and now the caption works fine again! Thanks to Andrew Nacin for the right tip!

    I am using a custom built theme and did not have ANY caption shortcode in my theme’s functions file. I found another thread on this issue that helped. I added this to my functions and it’s working properly now.

    add_shortcode( 'wp_caption', '' );
    add_shortcode( 'caption', '' );

    I’m not sure why this function is now required when it wasn’t before but as long as it’s working, I’m ok with it.

    I don’t have any shortcode in my functions.php file either. I tried adding this one inhouse gave but still can’t get captions working. Is there something I need to wrap these two lines of code with? Does the code have to be added at the top of the bottom of the functions.php file?

    I have not been able to add a caption into my photos for months. The caption appears to be there but when I preview or publish the post. Reading these comments about codes is like reading Greek. Can anyone help me?

    @dave333, you can place the code anywhere in your functions file but I’d recommend placing it right before the closing ?> that way you ensure you’re not interfering with any other functions.

    @lporterrn We’d need to see what the caption code looks like in the HTML tab of your page editor for a sample post and then a link to view the published post in order to help you further. Have you tried adding the function to your theme’s functions.php file?

    As per the Forum Welcome, please post your own topic. Posting in an existing topic prevents us from being able to track issues by topic. Added to which, your problem – despite any similarity in symptoms – is likely to be completely different.

    Closing topic.

Viewing 12 replies - 31 through 42 (of 42 total)
  • The topic ‘Caption broken in new 3.4 posts’ is closed to new replies.