Tag: images
Disable Thumbnail Image Sizes
add_filter( ‘intermediate_image_sizes_advanced’, function( $sizes ) { // Disable specific thumbnail sizes, uncomment the ones you want to disable. // unset( $sizes[‘thumbnail’] ); // 150px x 150px // unset( $sizes[‘medium’] ); // 300px x 300px // unset( $sizes[‘medium_large’] ); // 768px…Continue reading
Display Registered Image Sizes
global $_wp_additional_image_sizes; print ‘ ‘; print_r($_wp_additional_image_sizes); print ‘ ‘;Continue reading
Disable, Add, and Enable Thumbnail Sizes
// disable generated image sizes //function tps_disable_image_sizes($sizes) { // unset($sizes[‘thumbnail’]); // disable thumbnail size // unset($sizes[‘medium’]); // disable medium size // unset($sizes[‘large’]); // disable large size //unset($sizes[‘medium_large’]); // disable medium-large size //unset($sizes[‘1536×1536’]); // disable 2x medium-large size //unset($sizes[‘2048×2048’]); // disable…Continue reading
Allow Webp, SVG, ICO
function allow_additional_mime_types($mime_types) { $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘webp’] = ‘image/webp’; $mime_types[‘ico’] = ‘image/vnd.microsoft.icon’; return $mime_types; } add_filter(‘upload_mimes’, ‘allow_additional_mime_types’);Continue reading
Support for WebP Images
function g9_mime_types($mime_types) { $mime_types[‘webp’] = ‘image/webp’; //Adding webp extension return $mime_types; } add_filter(‘woocommerce_rest_allowed_image_mime_types’, ‘g9_mime_types’, 1, 1);Continue reading