The default image size for inserting images is stored in the options table in image_default_size
. You can change the default image size by updating the option:
update_option( 'image_default_size', 'large' );
Role-dependent default image size
To change the default image size for contributors only, you could hook into pre_option_[option]
filter (which is fired directly after sanitizing the option name passed to get_option
, giving you the possibility to change the value returned by get_option
) and return another image size for contributors only:
function myplugin_contributor_image_default_size( $value ) {
if ( current_user_can( 'contributor' ) ) {
return 'large';
}
return $value;
}
add_filter( 'pre_option_image_default_size', 'myplugin_contributor_image_default_size' );