How to make a image-size selected by default in Media upload – WP v3.5

Try this out. Your add_filter()’s second argument is a function, that will affect the current option via a return:

function theme_default_image_size() {
    return 'custom-image-size-2';
}
add_filter( 'pre_option_image_default_size', 'theme_default_image_size' );

You could also look into the pre_update_option_{$option} filter, and update the value once, so you don’t need to run this filter every time (may save 0.01s, but it’s still saving!) 🙂

or good old update_option():

update_option( 'image_default_size', 'custom-image-size-2' );

Leave a Comment