How to remove unnecessary thumbnail sizes in WordPress. Func... open

How to remove unnecessary thumbnail sizes in WordPress. Function example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
Tested: PHP 5.6 +
add_action( 'after_setup_theme', 'remove_plugin_image_sizes', 999 );
function remove_plugin_image_sizes(){
    remove_image_size('medium_large');
	remove_image_size('large');
	remove_image_size('1536x1536');
	remove_image_size('2048x2048');
}

This code removes four image sizes that were added by a WordPress plugin or theme.
Steps:
1. The function ‘remove_plugin_image_sizes‘ is called after installing the theme (‘after_setup_theme’) with priority 999.
2. The function removes four image sizes: ‘medium_large‘, ‘large‘, ‘1536×1536‘, ‘2048×2048‘.
3. This allows you to optimize page loading and reduce the size of stored images in WordPress.

0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation