Skip to content

Instantly share code, notes, and snippets.

@stefanledin
Last active December 22, 2018 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanledin/8aa971089c5361d4a568ddcc50070fbb to your computer and use it in GitHub Desktop.
Save stefanledin/8aa971089c5361d4a568ddcc50070fbb to your computer and use it in GitHub Desktop.
<?php
/**
* Custom image sizes
*/
add_image_size('my-custom-image-size', 768, null, false);
add_filter( 'image_size_names_choose', function( $sizes ) {
// Remove build in sizes
unset($sizes['thumbnail']);
unset($sizes['medium']);
unset($sizes['large']);
// Add the custom image size
$sizes['my-custom-image-size'] = 'My Custom Image Size';
return $sizes;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment