Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Created June 14, 2015 21:09
Show Gist options
  • Save zulhfreelancer/d5cd57b660b5ea5cb12d to your computer and use it in GitHub Desktop.
Save zulhfreelancer/d5cd57b660b5ea5cb12d to your computer and use it in GitHub Desktop.
Remove Image Sizes Option in WordPress Media Upload Window
// ADD NEW IMAGE SIZE
add_action( 'after_setup_theme', 'baw_theme_setup' );
function baw_theme_setup() {
add_image_size( 'full-post-width', 568 ); // 568 pixels wide (and unlimited height)
}
// REMOVE ALL IMAGE SIZES IN MEDIA UPLOADER WINDOW
function my_custom_image_sizes($sizes) {
unset( $sizes['thumbnail']);
unset( $sizes['medium']);
unset( $sizes['large']);
unset( $sizes['full'] );
// add your image sizes, i.e.
$myCustomImgsizes = array(
"full-post-width" => __( "Full Post Width" )
);
$newimgsizes = array_merge($sizes, $myCustomImgsizes);
return $newimgsizes;
}
add_filter('image_size_names_choose', 'my_custom_image_sizes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment