Resize full size images only for non-admin users

I want to disable "Resize my full-size images" option (https://gyazo.com/4da58b5ba36ade4a9d97f8429b5e3b4d) only for the admin user. So when the admin user uploaded an image it shouldn't resize, but when the other user roles uploaded an image it should resize. Is that possible?

  • Vaughan

    Hi FreshySites

    Can you try adding the following to your theme functions.php

    add_filter( 'wp_smush_resize_uploaded_image', 'smush_resize_non_admin', 10, 3 );
    function smush_resize_non_admin($should_resize, $id, $meta) {
        global $current_user;
    
        if(current_user_can('manage_options')) {
            return false;
        }
    
        return $meta;
    }

    Alternatively, create a file called wpmudev-custom-functions.php

    Add the following code to this file.

    <?php
    add_filter( 'wp_smush_resize_uploaded_image', 'smush_resize_non_admin', 10, 3 );
    function smush_resize_non_admin($should_resize, $id, $meta) {
        global $current_user;
    
        if(current_user_can('manage_options')) {
            return false;
        }
    
        return $meta;
    }

    Then upload this file to /wp-content/mu-plugins/
    (If mu-plugins folder doesn't already exist, create it first)

    Hopefully, that should now resize only for non-admins.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.