Support » Plugin: Image Regenerate & Select Crop » Creating thumbnail size just for one CPT

  • Resolved enthousiastwpuser



    First, thank you for your great plugin!
    I have one request and I would like to know if it’s possible and especially HOW I can achieve this.

    I added a code snippet to my site:

    “add_action( ‘after_setup_theme’, ‘my_images_setup’ );

    function my_images_setup() {
    add_image_size( ‘slider-image-feature’, 650, 650, true );

    I want to globally ignore the generation of my “slider-image-feature” thumbnail, but make it work on the image I upload to the “image feature” of my custom post type.

    How can I achieve this with your plugin?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Iulia Cazan



    As far as I understand how WordPress images upload and attachments work, there is no current method to identify on uploading the file if an image is uploaded through the featured image uploader or as any other media uploaded to a post, and the image becomes a “feature image of the post” (the post and the image are linked with this relationship) after the moment the upload occurred and the images were executed.

    However, there can be something done, but it’s not a reliable solution, as you would have to click the “Update” button for the post to trigger the generation of the expected size. The solution I am referring to is this:

    1. make the settings so that slider-image-feature to be globally ignored (so this is not generated for any normal upload)
    2. add this code in your theme or plugin

    add_action( 'update_post_metadata', 'my_images_setup_on_featured', 99, 5 );
    function my_images_setup_on_featured( $a, $b, $c, $d, $e ) {
    	if ( ! empty( $c ) && '_thumbnail_id' === $c && ! empty( $d ) ) {
    		SIRSC_Image_Regenerate_Select_Crop::make_images_if_not_exists( (int) $d, 'slider-image-feature' );

    3. click the update button after you select a featured image, then check if the image size expected has been genrated.

    Let me know how it goes.


    • This reply was modified 7 months, 3 weeks ago by  Iulia Cazan.
    Plugin Author Iulia Cazan



    I haven’t heard back from you in a while so I will mark this as resolved. You can start a new thread if you have any issues to report or questions.


    Yeah I ended up using other solutions because I didn’t receive reply from you.

    I did receive an email alert and saw that you replied 2 months later since my original post.
    So I bookmarked the topic so in case I want to reuse your plugin for another project I’ll use your solution, thank you.


Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.