-
AuthorPosts
-
May 13, 2022 at 1:13 pm #1351671
I am building a new website with a lot of photos and to save storage space I want to reduce the number of photo sizes created by Enfold.
I don’t need these sizes:
– 36×36 widget and other square image sizes
– 260×185 portfolio small
– 845×684 gallery
– 710×375 nagazine
– 845×321 entry with sidebar
– 1210×423 entry without sidebar
– 1500×430 featured
– 1500×630 featured largeIf I understood correctly I should then add the following code to my functions.php file (in my Child theme):
function ava_image_sizes() { remove_image_size('magazine'); remove_image_size('widget'); remove_image_size('featured'); remove_image_size('featured_large'); remove_image_size('portfolio_small'); remove_image_size('gallery'); remove_image_size('entry_with_sidebar'); remove_image_size('entry_without_sidebar'); remove_image_size('square'); } add_action( 'after_setup_theme', 'ava_image_sizes', 11 );
– Is that above code correct like this?
– After adding this code I have read the advice to use the Regenerate Thumbnails plugin, but this plugin is not updated for a year, so is it still recommended?Thanks for your help!
May 14, 2022 at 12:24 pm #1351762One other question: why is there the number 11 in the last line of the code:
add_action( ‘after_setup_theme’, ‘ava_image_sizes’, 11 );May 14, 2022 at 11:16 pm #1351815Hi,
Thank you for your question, your code looks correct and the Regenerate Thumbnails is still recommended, many basic plugins only need to be updated when the WordPress core changes for the specific function, which typically is seldom for this function.
The last number is the priority that it has.Best regards,
MikeMay 15, 2022 at 11:28 am #1351839Thank you Mike,
Can I also add these lines to the code above:
remove_image_size(‘shop_thumbnail’);
remove_image_size(‘shop_catalog’);
remove_image_size(‘shop_single’);
remove_image_size(‘shop_gallery_thumbnail’);Thanks,
AlwinMay 15, 2022 at 12:55 pm #1351842Hi,
You can add these:remove_image_size('shop_thumbnail'); remove_image_size('shop_catalog'); remove_image_size('shop_single');
but remove_image_size(‘shop_gallery_thumbnail’); is not correct, try:
remove_image_size('woocommerce_gallery_thumbnail'); remove_image_size('woocommerce_single'); remove_image_size('woocommerce_thumbnail');
Best regards,
MikeMay 15, 2022 at 5:43 pm #1351852Thank you Mike, everything worked out fine :)
Best Wishes,
AlwinMay 15, 2022 at 6:02 pm #1351854Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Remove unused Enfold image sizes’ is closed to new replies.