How to Stop Editors From Uploading Huge Images in WordPress
                            It’s a scenario that every WordPress developer and agency owner knows all too well. You’ve just launched a beautiful, lightning-fast website for a client. You hand over the keys, proud of your work. A week later, you run a speed test, and your perfect 98 PageSpeed score has plummeted to a dismal 45.
The culprit? Your well-meaning client or editor just uploaded a 15 MB, 6000-pixel-wide photograph straight from their new camera to use as a blog post header.
Huge, unoptimized images are the silent killers of website performance. They consume bandwidth, skyrocket page load times, and destroy the user experience you worked so hard to build. Manually training every client or team member on the intricacies of image preparation is a losing battle. It’s frustrating, time-consuming, and ultimately, ineffective.
So, how do you solve this problem once and for all? How do you enforce best practices without having to micromanage every single upload?
This is the definitive guide for agencies and site administrators on how to regain control over their WordPress media library and stop huge images from ever hitting their server.
Why “Just Tell Them to Resize It” Never Works
The first line of defense is always education. You can create detailed PDF guides, record Loom videos, and patiently explain to your clients the importance of resizing images to, say, 1920px wide and saving them for the web in Photoshop.
And for a week, it might even work.
But eventually, an urgent deadline will strike. A new marketing intern will join the team. The original point of contact will go on vacation. Sooner or later, someone, somewhere, will upload another massive, unoptimized image, and you’re back to square one.
Relying on manual training is not a scalable or reliable strategy. You need a system that enforces the rules automatically, acting as a gatekeeper for your media library.
Level 1: The Built-in WordPress “Big Image” Threshold
Since WordPress 5.3, the platform has a built-in mechanism to handle extremely large images. When a user uploads an image wider or taller than a certain threshold (by default, 2560px), WordPress automatically creates a scaled-down version and uses that as the new “full” size, while preserving the original file.
The Good:
- It prevents truly gigantic, print-resolution images from being used directly on the site.
 
The Bad:
- The Threshold is Too High: A 2560px wide JPEG can still easily be 1-3 MB. That’s still far too large for web use.
 - It Doesn’t Stop Large File Sizes: It only checks dimensions, not file weight. A user can still upload a 1500px wide image that weighs 5 MB due to low compression.
 - It Doesn’t Actually Stop the Upload: The massive original file is still uploaded to your server, consuming valuable disk space.
 
This feature is a safety net, but it’s not a solution.
Level 2: Using Code Snippets to Restrict Uploads
A more robust approach is to add custom code to your theme’s functions.php file or a custom plugin to validate images during the upload process. WordPress provides a handy filter called wp_handle_upload_prefilter that allows you to inspect a file right before it’s saved.
Here’s a basic example of what that code might look like:
add_filter('wp_handle_upload_prefilter', 'limit_image_uploads');
function limit_image_uploads($file) {
    // Limit file size to 2MB
    $max_size_mb = 2;
    if ($file['size'] > ($max_size_mb * 1024 * 1024)) {
        $file['error'] = 'Error: This image is too large. Please upload a file smaller than ' . $max_size_mb . 'MB.';
        return $file;
    }
    // Limit dimensions to 2000px
    $image_data = getimagesize($file['tmp_name']);
    $max_dims_px = 2000;
    if ($image_data[0] > $max_dims_px || $image_data[1] > $max_dims_px) {
        $file['error'] = 'Error: This image is too wide or tall. Please resize it to be under ' . $max_dims_px . 'px.';
        return $file;
    }
    return $file;
}
The Good:
- It Works: This code effectively stops users from uploading files that exceed the defined limits.
 - Provides Immediate Feedback: The user sees an error message directly in the media uploader.
 
The Bad:
- One Rule for Everyone: This code applies the same limits to all users. What if you, as the administrator, need to upload a larger file, but you want to restrict your “Editor” or “Author” roles? This code can’t do that.
 - Requires Coding: You need to be comfortable editing PHP files. This isn’t a user-friendly solution for most site owners.
 - Hard to Maintain: If you need to change the limits, you have to dig back into the code.
 
This is a good step forward, but it lacks the flexibility needed for professional workflows.
Level 3 (The Professional Solution): Role-Based Upload Policies
What if you could set different rules for different users? What if you could allow administrators to upload anything, but force editors to adhere to strict size and dimension limits?
This is where a truly professional tool comes in. Instead of a one-size-fits-all approach, you need a system of Upload Policies.
This is a core PRO feature of the Media Optimizer plugin, designed specifically for agencies and teams. From a simple, user-friendly interface, you can define precise rules for each user role on your site.
How it works:
- Go to the Media Optimizer Settings: Navigate to the “Advanced” tab.
 - Find the “Upload Policies” Section: You’ll see a list of all user roles on your site (Administrator, Editor, Author, etc.).
 - Set Your Limits: For each role, you can independently set:
- Max file size (in MB): e.g., Editors can only upload files up to 2MB.
 - Max dimensions (in px): e.g., Authors can only upload images up to 1920px wide or tall.
 
 - Save and Relax: That’s it. The plugin now works as your vigilant gatekeeper, 24/7.
 
Why this is the ultimate solution:
- ✅ Granular Control: You have complete, role-by-role control over your media library. This is essential for managing client sites and content teams.
 - ✅ Flexibility for Admins: As an administrator, you can leave your own limits blank, giving you the freedom to upload larger files when necessary, without changing any code.
 - ✅ No Coding Required: Everything is managed from a clean, intuitive user interface within the WordPress dashboard.
 - ✅ Enforces Best Practices Automatically: You establish a workflow that guarantees a healthy, optimized media library, preventing performance degradation before it even starts. It’s a proactive, not a reactive, approach.
 
Conclusion: Stop Policing, Start Automating
Stop the endless cycle of finding oversized images, manually optimizing them, and re-training your team. Relying on human processes for a technical task is bound to fail. The only reliable solution is to build the rules directly into your workflow.
While WordPress provides some basic safety nets and code snippets offer a temporary fix, a professional Upload Policies system is the only way to truly solve this problem at scale. It saves you time, prevents performance headaches, and ensures your websites stay lightning-fast, just as you intended.
Ready to take back control of your media library? Upgrade to Media Optimizer PRO and enable Upload Policies today.