De-register custom image upload sizes

Remove all custom MD image sizes from the Media uploader


De-registers all MD image sizes. Add to your functions.php file.

Click to copy
 * De-register custom MD image upload sizes.
 * @since 1.0

function md_child_theme_image_sizes( $sizes ) {
	unset( $sizes['md-full'] );
	unset( $sizes['md-banner'] );
	unset( $sizes['md-block'] );
	unset( $sizes['md-image'] );
	unset( $sizes['md-book'] );
	unset( $sizes['md-thumbnail'] );
	return $sizes;

add_filter( 'md_filter_image_sizes', 'md_child_theme_image_sizes' );

Marketers Delight registers its own custom image sizes to help better format images in specific layout areas using the native add_image_size WordPress function.

Each time you upload an image, WordPress creates a separate cropped version of each image and saves it to your uploads folder.

Not every version of these images may be used in your site, so to help cut down the number of extra images stored to your site you can use this simple filter to de-register any custom image sizes you don’t need.

Tip: after enabling this filter in your child theme, or anywhere else you execute custom functions, run the Regenerate Thumbnails plugin to delete all unused images and free up your disk space.

Leave a Comment

November sale: Save 25% on all new licenses!