Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a front end form to let users upload images to my website and i set the post attachment image like this:

// find the most recent attachment for the given post
        $attachments = get_posts(
                'post_type' => 'attachment',
                'numberposts' => 1,
                'order' => 'ASC',
                'post_parent' => $new_post
        $attachment = $attachments[0];

        // and set it as the post thumbnail
        set_post_thumbnail( $new_post, $attachment->ID );

It's working... but i want to set/force the size of the image to be ('my-size') so i created this custom size:

add_image_size( 'my-size', 615, 9999 );

But i don't know how to set it up...

How can i accomplish this?

share|improve this question
Without seeing the upload code it would be impossible to tell since image_default_size in not related to a default WordPress. –  Wyck Jan 21 at 0:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.