Advertisement
Guest User

Remove Image Sizes

a guest
Dec 18th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. function eusb_remove_image_sizes( $sizes ) {
  2.     foreach ( $sizes as $key => $name ) {
  3.         if ( in_array( $name, array( 'medium_large', '1536x1536', '2048x2048' ), true ) ) {
  4.             unset( $sizes[ $key ] );
  5.         }
  6.     }
  7.  
  8.     // Return as consecutive array.
  9.     return array_values( $sizes ;
  10. }
  11. add_action( 'intermediate_image_sizes', 'eusb_remove_image_sizes', 999 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement