Created
June 14, 2015 21:09
-
-
Save zulhfreelancer/d5cd57b660b5ea5cb12d to your computer and use it in GitHub Desktop.
Remove Image Sizes Option in WordPress Media Upload Window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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