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

1 Answer 1


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
  • thanks for response, but nothing happen! i think the filter is server side and this check is client
    – johnmido
    Jun 17, 2012 at 17:35

Your Answer

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

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