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

How would I run add_filter only on some specific registered thumbnail sizes '$size' ? like 'large' , 'medium', etc?

share|improve this question

The class attribute contains the size in the format attachment-$size, you could do a check for a specific size like:

if( strstr( $attr['class'], 'thumb' ) ):
    // size is attachment-thumb
share|improve this answer
thanks for response, but nothing happen! i think the filter is server side and this check is client – johnmido Jun 17 '12 at 17:35

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.