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 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.

share|improve this question

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.

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.