WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using wp-caption for so long but for a template I am working on I want to delete this tag and only show the image, I used display:none; function but it does not show the image , any help ?

share|improve this question
.wp-caption-text{display: none;} – Howdy_McGee Dec 3 '13 at 15:07

You'll need to use the img_caption_shortcode filter to do this. Pretty certain the alignment of the image (floating left/right) is part of the caption so you'll lose the ability to do that with this code.

function imageOnly($deprecated, $attr, $content = null) 
    return do_shortcode( $content );
add_filter( 'img_caption_shortcode', 'imageOnly', 10, 3 );

The do_shortcode is probably overkill.

I use something very similar to change the caption output to be responsive. Tested on WordPress 3.8.1

share|improve this answer
do_shortcode() is helpful, if you like it, that the shortcodes inside the content works after remove caption --> +1 for this answer. – bueltge Jan 1 '15 at 20:13
Didn't worked for me in WP 4.2.5 – testing Oct 13 '15 at 20:39

This code found on the WP Support forums (Can you remove captions from images?) worked for me:

function no_caption($deprecated, $attr, $content) { return $content; };
add_filter('img_caption_shortcode', 'no_caption', 10, 3);

Just drop it in your theme's functions.php

share|improve this answer
Didn't worked for me in WP 4.2.5 – testing Oct 13 '15 at 20:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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