[Smush Pro] Smush Pro Causing Media Library to Stop Loading

Over the weekend, when accessing our website I noticed the media library would not load. The little circular icon would keep spinning but nothing would load. After deactivating different plugins I noticed the problem was Smush Pro. When I activate, the library won't load. When I deactivate, the library works as it should.

Additionally, one of your support staff had given me a custom "mu-plugin", allowing me to choose which images would or would not be super smushed. It worked as it should until this issue, which caused my site to break when i initially deactivated smush. So I had to remove the custom plugin through ftp for my site to go back on.

  • Adam Czajczyk
    • Support Gorilla

    Hello Luke Miller

    I hope you’re well today and thank you for reaching out to us!

    The “mu plugin” containing a custom code might indeed be too “simple” to detect whether Smush is active or not and that, in turn, might cause issue if the Smush plugin is deactivated. I could tell you more if I knew the code inside that custom plugin so would you mind sharing it here too?

    As for Smush causing issues with Media Library. Do you have many images uploaded there? Would you mind me taking a look inside to see what might be causing it?

    To allow me check it, please enable support access to the site. You can do this by going to the “WPMU DEV -> Support -> Support Access” page in site’s back-end and clicking on “Grant support acccess” button there.

    Let me know once it’s done, please, as I won’t be automatically notified.

    Best regards,


  • Adam Czajczyk
    • Support Gorilla

    Hello Luke Miller

    Thank you for granting access.

    I checked the site and one good news is that the Media Library doesn’t go away “entirely”. If you switch it to a “list” view instead of “grid” – it does load and show all the images even with Smush enabled.

    In a “Grid” view, however, there’s an admin-ajax.php error showing up in the console, though there’s not much additional info. The error is a “500 Internal Server Error” which usually is related to either some resource issues or due to the conflict on site(with a theme or other plugin).

    I noticed that you got WP Optimize enabled on site, along with its image optimization so started with disabling it (it’s enabled back) as keeping two image optimization tools on at the same time isn’t the recommended idea (it won’t “optimize images more” but can cause some unexpected issues) but in this case it doesn’t seem to be related.

    I understand that the site is a live site so I didn’t want to risk too many changes/experiments there but it would be best to run a full conflict test on the site as follows:

    – disable all the plugins except for Smush Pro and switch site to Twenty Nineteen theme

    – clear all caches, especially on server if there is any

    – see if the issue is gone and if so

    – enable one plugin back, check again, enable next plugin and check and so on until the issue starts again.

    The last enabled plugin (or the theme if it was the last enabled thing) will be the source of the conflict and we would take it from there. Please note: I realize that you tried disabling plugins and that pointed to Smush but the point of this test is to find what exactly is causing Smush to behave this way (so what’s interfering with it).

    Could you please run such test (it’s important to do it this specific way) and let me know about results?

    Best regards,


  • Luke Miller
    • WPMU DEV Initiate

    I cleared the cache and disabled the optimization plugin, since our site is live I didn’t want to deactivate all of our plugins or change the theme. However, I did notice something interesting that could have caused the problem.

    In a previous support forum, I asked if there was a way for me to prevent certain images from being super smushed, since the compression was too lossy for our banner image. The support staff created a plugin for me to prevent that specific image so I could have a setting that said don’t smush this image.

    If you notice when looking at the media library in “Grid” view under the “Smush” column it says next to the image “Attorneys-banner”

    “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.”

    I think the mu-plugin even when removed created some sort of error within the smush code, since the image had that setting enabled. When you visited my site and activated smush i got an email from wordpress that said Smush was causing a fatal error on the site and to deactivate it. Obviously i didnt bc i saw you were actively trying to solve the issue. The email did however provide an error log.

    Error Details


    An error of type E_ERROR was caused in line 268 of the file /home2/thesuff1/public_html/wp-content/plugins/wp-smush-pro/core/modules/class-wp-smushit.php. Error message: Uncaught Error: Cannot use string offset as an array in /home2/thesuff1/public_html/wp-content/plugins/wp-smush-pro/core/modules/class-wp-smushit.php:268

    Stack trace:

    #0 /home2/thesuff1/public_html/wp-content/plugins/wp-smush-pro/core/modules/class-wp-smushit.php(94): WP_Smushit->combined_stats(‘skipped’, Array)

    #1 /home2/thesuff1/public_html/wp-content/plugins/wp-smush-pro/core/class-wp-smush-admin.php(399): WP_Smushit->set_status(24492)

    #2 /home2/thesuff1/public_html/wp-includes/class-wp-hook.php(286): WP_Smush_Admin->custom_column(‘smushit’, 24492)

    #3 /home2/thesuff1/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array)

    #4 /home2/thesuff1/public_html/wp-includes/plugin.php(465): WP_Hook->do_action(Array)

    #5 /home2/thesuff1/public_html/wp-admin/includes/class-wp-media-list-table.php(610): do_action(‘manage_media_cu…’, ‘smushit’, 24492)

    #6 /home2/thesuff1/public_html/wp-admin/includes/class-wp-list-table.php(1332): WP_Media_List_Table->column_default(Object(WP_Post), ‘smushit’:wink:

    I am attaching the mu-plugin. Can you please look at it bc i really believe that is where the problem is. And unfortunately, even when I readded the custom plugin to the mu-plugins folder, the option to bypass super smush is no longer there bc I believe it is only an option from Media view rather than Grid View. Therefore, I can’t change the setting on the Image that is causing the problem and reverse the errors.

    Please, please help me as soon as you can. I don’t want to delete the image since it is the main banner to our site, but if you can’t help me I think that’s what I’ll have to do to prevent the error.

  • Luke Miller
    • WPMU DEV Initiate

    Here’s the code to the plugin since the file type is not allowed?

    * Plugin Name: WP Smush Pro Exclude
    * Plugin URI: https://premium.wpmudev.org/
    * Description: This plugin will help to exclude specific image attachments from being Smushed
    * Author: Ariful Islam, Vaughan Montgomery @ WPMU DEV
    * Author URI: https://premium.wpmudev.org/profile/vaughan
    * License: GPLv2 or later
    if ( ! defined( 'ABSPATH' ) ) {
    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

    if ( !is_plugin_active( 'wp-smush-pro/wp-smush.php' ) ) {
    * Adding Skip smushing field to image attachments
    Class WPMUDEV_Smush_IMG_Custom_Fields {

    private $media_fields = array();

    function __construct( $fields ) {
    $this->media_fields = $fields;

    add_filter( 'attachment_fields_to_edit', array( $this, 'applyFilter' ), 11, 2 );
    add_filter( 'attachment_fields_to_save', array( $this, 'saveFields' ), 11, 2 );

    add_filter( 'wp_smush_image', array( $this, 'exclude_attachment_from_smushing' ), 20, 2 );

    public function exclude_attachment_from_smushing( $smush, $id ) {

    $skip = get_post_meta( $id, '_skip_smushing', true ) ? true : false;

    if ( !$skip ) return $smush;

    update_post_meta( $id, 'wp-smpro-smush-data', 'skipped' );

    return false;

    public function applyFilter( $form_fields, $post = null ) {
    if ( ! empty( $this->media_fields ) ) {
    foreach ( $this->media_fields as $field => $values ) {
    if ( preg_match( "/" . $values['application'] . "/", $post->post_mime_type) && ! in_array( $post->post_mime_type, $values['exclusions'] ) ) {
    $meta = get_post_meta( $post->ID, '_' . $field, true );

    switch ( $values['input'] ) {
    case 'checkbox':
    $values['input'] = 'html';

    if ( $meta == 'on' ) {
    $checked = ' checked="checked"';
    } else {
    $checked = '';

    $html = '<input' . $checked . ' type="checkbox" name="attachments[' . $post->ID . '][' . $field . ']" id="attachments-' . $post->ID . '-' . $field . '" />';

    $values['html'] = $html;


    $values['value'] = $meta;

    $form_fields[$field] = $values;

    return $form_fields;

    function saveFields( $post, $attachment ) {
    if ( !empty( $this->media_fields ) ) {
    foreach ( $this->media_fields as $field => $values ) {
    if ( isset( $attachment[$field] ) ) {
    $attachment[$field] = $attachment[$field] ? 'on' : '';
    update_post_meta( $post['ID'], '_' . $field, $attachment[$field] );
    } else {
    delete_post_meta( $post['ID'], '_' . $field );
    if( 'skipped' == get_post_meta( $post['ID'], 'wp-smpro-smush-data', true ) ) {
    delete_post_meta( $post['ID'], 'wp-smpro-smush-data' );

    return $post;

    $attachment_options = array(
    'skip_smushing' => array(
    'label' => __( 'Exclude Image from being Smushed', 'smushpro' ),
    'input' => 'checkbox',
    'application' => 'image',
    'exclusions' => array( 'audio', 'video', 'PDF' )

    $cmf = new WPMUDEV_Smush_IMG_Custom_Fields( $attachment_options );

  • Predrag Dubajic
    • Support

    Hi Luke,

    Thanks for the additional info, I did some additional tests with that mu-plugin and tried excluding some images, doing a bulk smush, then disabling mu-plugin and accessing media library but grid view still worked fine for me so it looks like there's something else causing this on your end.

    Could you provide us with FTP or cPanel login details so we can check this in-depth?

    Note: Don't leave your login details in this ticket.

    Instead, you can send us your details using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question and the template below:

    NOTE: Don't change the selected topic in the dropdown, just leave it at "I have a different question".

    Subject: "Attn: Predrag Dubajic"

    – Site login URL

    – WordPress admin username

    – WordPress admin password

    – FTP credentials (host/username/password)

    – cPanel credentials (host/username/password)

    – Folder path to site in question

    – Link back to this thread for reference

    – Any other relevant urls/info

    P.S. Exclude from Smush option is available in List mode as well, when you go to edit your image just scroll down to the bottom of the page to see the option:

    Best regards,


  • Luke Miller
    • WPMU DEV Initiate

    Hello Predrag,

    So I unchecked the option to “exclude the image from being smushed” and that allowed the fatal error to stop occurring and the media library to finally load as it should. Then when I checked the option again, it still worked as it should.

    I think the mu-plugin that i received “wpmudev-img-skip-smush” is just a bit buggy. I need to keep using it as i need that image to not be super smushed so if there is an updated version of the mu-plugin that doesn’t cause the fatal errors mentioned above then that would be great otherwise at least I know what to do now if this happens to me in the future.

  • Luke Miller
    • WPMU DEV Initiate

    Vaughan, when I add the new file to the mu-plugins folder, i get a wordpress error when entering the dashboard. “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.”

    Reuploaded the older version so it doesn’t break my site

  • Adam Czajczyk
    • Support Gorilla

    Hello Luke Miller

    If you access your server via FTP you should be able to find an error_log file there. Also if you had WP debugging enabled by having at least these lines in wp-config.php file

    define( ‘WP_DEBUG’, true );

    define( ‘WP_DEBUG_LOG”, true );

    you should be able to find a file named “debug.log” inside the /wp-content/ folder – that one could also be helpful.

    Alternatively, you might have an insight to some WP/PHP error logs via your server’s management panel (such as e.g. cPanel). A look into these logs could help us find out why Vaughan’s version of the mu-plugin breaks your site.

    Best regards,


  • Luke Miller
    • WPMU DEV Initiate

    Hey, sorry for getting back so late, here is the error log when adding the updated mu-plugin

    Fatal error: Uncaught Error: Call to undefined function is_plugin_active() in /home2/thesuff1/public_html/wp-content/mu-plugins/wpmudev-img-skip-smush.php:17 Stack trace: #0 /home2/thesuff1/public_html/wp-settings.php(293): include_once() #1 /home2/thesuff1/public_html/wp-config.php(77): require_once(‘/home2/thesuff1…’:wink: #2 /home2/thesuff1/public_html/wp-load.php(37): require_once(‘/home2/thesuff1…’:wink: #3 /home2/thesuff1/public_html/wp-admin/admin.php(34): require_once(‘/home2/thesuff1…’:wink: #4 /home2/thesuff1/public_html/wp-admin/index.php(10): require_once(‘/home2/thesuff1…’:wink: #5 {main} thrown in /home2/thesuff1/public_html/wp-content/mu-plugins/wpmudev-img-skip-smush.php on line 17

    The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

    Notice: is_404 was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home2/thesuff1/public_html/wp-includes/functions.php on line 4773

  • Vaughan
    • Support/SLS MockingJay

    Hi Luke,

    Try this version (though Predrags should work too in admin pages only.)

    i’ve added a check to see if is_plugin_active() is defined or not instead.

    Hopefully this should fix it once and for all, we will be including this feature in a not so distant Smush Update too, so once that’s released you should remove this mu-plugin.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.