1

You can see live example here. When I add a caption into the image, it doesn't show at all!
I've added the caption to the image as you can see in the next picture

Here

but it doesn't show as you see below

here

But when I click edit the picture icon as you see below

here

and fill in the caption field

here

the caption works!

fine

Why it's not working in the first case? I've disabled all plugins and no luck! I've tried the twenty fourteen theme, and no problem there, so the problem is in my theme only. Can you please help!

7
  • What is the code that displays the image?
    – s_ha_dum
    Mar 15, 2014 at 17:21
  • You can see it live here wpcandle.com/caption-test Mar 15, 2014 at 17:25
  • No, I can't. All I can see is the generated HTML. That is usually pretty useless. Where is the PHP source?
    – s_ha_dum
    Mar 15, 2014 at 17:29
  • What PHP? I am not using a function to generate the caption, I am using the ordinary media uploader as you can see in the images above. I'm retrieving it with the_content() nothing unusual here :) Mar 15, 2014 at 17:36
  • The Core functions are behaving as they are supposed to, as near as I can tell. If you want different behavior you will need to write code.
    – s_ha_dum
    Mar 15, 2014 at 18:10

1 Answer 1

0

I solved it, the problem was a function I used to use and forgot about!

 add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
 add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
 function remove_thumbnail_dimensions( $html ) {
     $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
     return $html;
 }

I removed this function and everything is OK now.

1
  • Always great if you can solve your own problem. Don't forget to accept your answer as a solution. +1 Mar 15, 2014 at 20:09

Your Answer

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

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