Skip to content

Instantly share code, notes, and snippets.

@morgyface
Last active July 8, 2019 21:34
Show Gist options
  • Select an option

  • Save morgyface/c92773b47bb0fd5ec3107714fa876af7 to your computer and use it in GitHub Desktop.

Select an option

Save morgyface/c92773b47bb0fd5ec3107714fa876af7 to your computer and use it in GitHub Desktop.
WordPress | Function | Setting reserved image sizes on theme activation
<?php
// Setting reserved image sizes on theme activation
add_action( 'after_switch_theme', 'enforce_image_size_options' );
function enforce_image_size_options() {
update_option( 'thumbnail_size_w', 160 );
update_option( 'thumbnail_size_h', 160 );
update_option( 'thumbnail_crop', 1 );
update_option( 'medium_size_w', 660 );
update_option( 'medium_size_h', 440 );
update_option( 'medium_crop', 1 );
update_option( 'large_size_w', 1920 );
update_option( 'large_size_h', 1920 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment