Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • VirtualBox
  • VMware
  • Windows
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • VirtualBox
  • VMware
  • Windows
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

Disable WordPress from Generating Various Image Sizes Automatically

November 10, 2022
in Blog, Wordpress
0
ADVERTISEMENT

Table of Contents

If you are using WordPress when you upload an image it will automatically generate six images of varying sizes. WordPress generating multiple sizes is a little bit pointless especially when you’re not going to use those images as it will take your hosting space.

There is a simple way to disable it in a simple way without a plugin. And luckily this post will explain how to disable WordPress from generating various image sizes automatically with two methods, without a PHP code and with a PHP code inside your theme function.php.

Disable Generating Auto Image Sizes Without Coding

To prevent WordPress from generating different image sizes after uploading an image, follow these steps:

Log into WordPress with the Administrator role account.
On the Dashboard in the left sidebar, go to Settings, and go to Media (see the screenshot below).
In the Media Settings, set the width and height to zero for Thumbnail size, Medium size, and Large size.
Click on Save Changes, to save the changes.

Note Note: This method has cons which are it still generates medium large images, 1536×1536 and 2048×2048 sizes.

Disable Generating Auto Image Size with Coding to Your function.php

If you want to completely disable all the image sizes, insert this code to your function.php

function disable_media($sizes) {
    unset($sizes['thumbnail']);
    unset($sizes['medium']);
    unset($sizes['medium_large']);
    unset($sizes['large']);
    unset($sizes['1536x1536']);
    unset($sizes['2048x2048']);
    return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'disable_media');
add_filter('big_image_size_threshold', '__return_false');

You might also want to add this to set the size to zero to disable WordPress from generating images when you activated your theme

if (isset($_GET['activated']) && is_admin()) {
    update_option('posts_per_page', 12);
    update_option('thumbnail_size_w', 0);
    update_option('thumbnail_size_h', 0);
    update_option('thumbnail_crop', 1);
    update_option('medium_size_w', 0);
    update_option('medium_size_h', 0);
    update_option('medium_large_size_w', '0');
    update_option('medium_large_size_h', '0');
    update_option('large_size_w', 0);
    update_option('large_size_h', 0);
}

That’s it, now WordPress won’t autogenerate all the images you upload from now on.

If you want WordPress to generate a thumbnail with the sizes you set, insert this code.

// This will set your thumbnail size to 421x263.
add_image_size('bigthumb', 421, 263, true);
5/5 - (1 vote)
Previous Post

How to Upgrade Symantec Endpoint Protection 14 to Latest Version

Next Post

How to Upgrade Symantec Endpoint Client Remotely from SEPM

Related Posts

Ftr38

[WinForms] Creating GUIs in Windows PowerShell with WinForms

November 15, 2023
Ftr21

Converting DateTime Obtained from Microsoft Graph Call to PowerShell Date and Time Format

October 21, 2023
Ftr21

Translate Microsoft 365 License GUIDs to Product Names in PowerShell Microsoft Graph

October 19, 2023
Ftr21

How to Get an Access Token for Microsoft Graph PowerShell / API

November 27, 2023
Ftr21

Getting Access Token for Microsoft Graph

November 27, 2023
Ftr5

How to Copy Files without Changing Date Creation Time on Windows

November 27, 2023

Leave a Reply Cancel reply

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

Recent Posts

  • [WinForms] Creating GUIs in Windows PowerShell with WinForms
  • Converting DateTime Obtained from Microsoft Graph Call to PowerShell Date and Time Format
  • Translate Microsoft 365 License GUIDs to Product Names in PowerShell Microsoft Graph

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2023 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory