Asset Optimization is not working when using a Divi child theme

I’ve updated Hummingbird and after that, anytime I try to activate the Asset Optimization the page just loads back to itself and no file is optimized. 
I checked that this is only happening when using the Divi child theme that I use on my site (if switching to 2017 or to the Divi theme I can see the assets).

  • Katya Tsihotska

    Hi Craig Allen

    Hope you're having a wonderful day!

    I can confirm that Hummingbird Assets Optimization supports child themes as well. I also checked this on my end with another child theme (not Divi) and it works fine. So I suppose it's a theme-specific issue.

    In order to get more information about this issue, I'd request you to perform one more test:

    Enable wp debug. To enable it, change the following line in your wp-config.php file:
    define('WP_DEBUG', false);
    To this:

    // Enable WP_DEBUG mode
    define( 'WP_DEBUG', true );
    // Enable Debug logging to the /wp-content/debug.log file
    define( 'WP_DEBUG_LOG', true );
    // Disable display of errors and warnings
    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );

    Please make sure to add the above code just before the line /* That's all, stop editing! Happy blogging. */

    After this, try to replicate the issue again, I mean switching your theme to the Divi Child theme and re-check files at the Assets Optimization page. Then go to /wp-content folder and check if debug.log file is there. If it's there. download it, save as debug.txt and attach to your next reply.

    Or just let us know if you allowing us to perform this test for you.

    Kind regards,
    Katya

  • Katya Tsihotska

    Hi Craig Allen

    Thank you for performing the test! I've checked the log, but I don't see anything relevant there. There is an error that repeats several times, but it's not related to the issue. Here it is:
    PHP Fatal error: Uncaught Error: Call to a member function get_type() on null in ***/wp-content/plugins/donations-for-woocommerce/donations-for-woocommerce.php:120

    As you can see it's related to the Donations for WooCommerce plugin, so it's worth to contact the plugin support team and let them know about this issue. However, as I already mentioned it's not the cause of the issue with Hummingbird.

    I'm going to need to ping our SLS team (code experts) and get their valuable feedback on this, but I see that you've changed the WordPress login credentials, so please, send us new credentials through our secure contact form https://premium.wpmudev.org/contact/#i-have-a-different-question using this template:

    Subject: "Attn: Katya Tsihotska"
    -WordPress admin username
    -WordPress admin password
    -login URL
    -link back to this thread for reference
    -any other relevant URLs

    Please use this subject line to ensure that it gets assigned to me :slight_smile: DO NOT post any login credentials here, as it's a public forum and anyone can see them.

    Kind regards,
    Katya

  • Lindeni Mahlalela

    Hello Craig Allen

    I hope you are doing great. I am sorry for the delayed response here.

    I have accessed your website and found that Asset Optimization is active already and the assets are marked as 'Compressing' which means they are queued for compressing.

    Hummingbird should compress optimize the assets according to the settings as soon as they are requested on the front end, meaning when someone visits the page the assets will be requested and Hummingbird will optimize them, this is usually immediately after a page hit on the front end, however, I noticed that this is not a case on your website.

    I then checked the source code of the website and found that the scripts are loaded as follows:

    <script type="text/rocketscript" data-rocketsrc="https://domain.com/path/filename.js?ver=x"></script>

    This is related to CloudFlare's Rocket Loader feature which compresses, concatenates and defers any JavaScripts on your web page to optimize your website's speed. This is essentially the same thing as Hummingbird's Asset Optimization feature, the main difference being that Hummingbird optimizes the assets and stores them on your website/WPMU DEV CDN while CloudFlare's Rocket Loader optimizes the assets and stores them on their CDN and on the browser's local storage.

    The reason why the Assets on your website are not optimized is because CloudFlare loads the files from their CDN and some from the browser's local storage which means the files are never requested from the website until the CDN requests them from the website, usually when updating CDN cache. CloudFlare does this making it pointless to also try to achieve the same using Hmmingbird since CloudFlare caches the page and the scripts on their CDN and returns them from there, which means at some point your website is never hit because CloudFlare serves the content from their CDN.

    Basically, according to my understanding you cannot have both Hummingbird Asset Minification and CloudFlare Rocket Loader because they both want to achieve the same thing. So, if you want to keep CloudFlare you might also want to deactivate HUmmingbird Asset Optimization or Disable CloudFlare Rocket Loader and use Hummingbird Asset Optimization. Which one you use will depend on the level of control you want over your assets, with hummingbird you can choose what to do to which assets so you have control, I haven't tried CloudFlare Rocket Loader but I think it does most of the work automatically giving less control which means if something breaks on your website then you will have to deactivate it.

    I do understand that you said this is related to Divi and Divi Child theme, but I suggest that you experiment with the Rocket Loader deactivated on CloudFlare and see if you won't be able to load Assets or not.

    I hope this makes sense, but please let us know if you need any further assistance with regards to this.

    Have a nice day.
    Lindeni