Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

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 at 20:13
Didn't worked for me in WP 4.2.5 – testing Oct 13 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 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.