Created
September 11, 2024 22:52
-
-
Save Acephalia/2a58658bcb05a4ecbbdbfa82a4489661 to your computer and use it in GitHub Desktop.
Disable Divi Image Size Generation On Upload
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
/* | |
* @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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Reddit thread: https://www.reddit.com/r/divi/s/GEC7ANmEkd
Support the support: https://buymeacoffee.com/acephaliax