Limit image file size? | WordPress.org

[ad_1]

Hi @rghedin, thank you for reaching out!

You can easily limit the maximum upload size for images on your WordPress site by using a simple filter hook. To do this, you can add the following code snippet to your theme’s functions.php file, or to a custom plugin:

add_filter('simple_local_avatars_upload_limit', function() {
    return 1024*100; // 100 KB
});

This code will limit the upload size of images to 100 KB, which you can adjust by changing the number value to your desired file size limit. This will help ensure that your site’s users only upload images that are appropriately sized, which can improve site performance and reduce storage costs.

I hope this helps!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer