I know how to add a new thumbnail size to my custom plugin. But i want to know if is possible to restrict de new size only to a certain custom post type?

Thanks in advance.

1 Answer 1


You cant without editing core files but you can name it any way you want so you can call it from you plugin:

if ( function_exists( 'add_image_size' ) ) { 
    add_image_size( 'my-plugin-thumb', 220, 180, true );

and call it

if ( has_post_thumbnail() ) { 
    the_post_thumbnail( 'my-plugin-thumb' );

it's not perfect but its something.

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.