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'm currently adding thumbnails to my page with: <?php the_post_thumbnail( 'category-thumb' ); ?> and this in the fuctions.php:

if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'category-thumb', 200, 142 );

How do i stop the title tag from being added?

share|improve this question
Why do you want to get rid of it? – kaiser Oct 24 '12 at 1:19
@kaiser because i only want the src, alt, height, and width – Joe Bobby Oct 24 '12 at 2:34
That's exactly no explanation. I was asking for a reason and you're telling me your task... – kaiser Oct 24 '12 at 10:54
up vote 1 down vote accepted

This filter will remove it completely from all images, you can add a conditional to only effect certain images.

function remove_img_title($atts) {
    return $atts;

Instead if you want to use <?php the_post_thumbnail( 'category-thumb' ); ?>

You can pass it an empty title using the second $attr so your title tag will look like title=" ".

It would be:

$default_attr = array('title'   =>  ' ');
the_post_thumbnail('post-thumbnails', $default_attr);
share|improve this answer

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.