Skip to content

Instantly share code, notes, and snippets.

@Acephalia
Created September 11, 2024 22:52
Show Gist options
  • Save Acephalia/2a58658bcb05a4ecbbdbfa82a4489661 to your computer and use it in GitHub Desktop.
Save Acephalia/2a58658bcb05a4ecbbdbfa82a4489661 to your computer and use it in GitHub Desktop.
Disable Divi Image Size Generation On Upload
/*
* @snippet Disable Divi Image Size Generation On Upload
* @author https://gist.github.com/Acephalia
* @caffeinate https://buymeacoffee.com/acephaliax
*/
function disable_divi_image_sizes() {
// Remove all image sizes registered by Divi
remove_image_size('et-pb-post-main-image'); // Divi's post main image size
remove_image_size('et-pb-portfolio-image'); // Divi's portfolio image size
remove_image_size('et-pb-portfolio-module-image'); // Divi's portfolio module image size
remove_image_size('et-pb-gallery-module-image'); // Divi's gallery module image size
remove_image_size('et-pb-fullwidth-image'); // Divi's fullwidth module image size
}
add_action('after_setup_theme', 'disable_divi_image_sizes');
// Disable WordPress intermediate sizes too
function remove_default_image_sizes( $sizes ) {
return array();
}
add_filter( 'intermediate_image_sizes_advanced', 'remove_default_image_sizes' );
@Acephalia
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment