[HUMMINGBIRD] disable JS file from CDN

I have a plugin that I use to run custom JS code on my website, and the problem is that Hummingbird takes one of it's source files to the CDN and just uploads the PHP code as if it was JS.

When you go to the website you can see it in the console errors

  • Adam Czajczyk
    • Support Gorilla

    Hello Adam Boa,

    I hope you're well today and thank you for your question!

    There's currently no way to exclude selected files from being pushed to the CDN while serving all other files from there - so it's either CDN enabled or not (and all the files served directly from your server).

    However, I'm a bit confused of the case. The FTP credentials that you shared during the chat only gives access to an empty folder with no option to go anywhere else (most likely there's a wrong path/folder assigned to the FTP user) so I couldn't check the site but from what I can see on a screenshot, it looks like there's a JS file - enqueued as a script - that contains a PHP code that should actually be executed in a different way.

    Does the screenshot show entire code in that file in question? Is there any specific reason for using it like that? I'm asking because I think that instead of looking for a way to "trick Hummingbird" to ignore that file, we should rather look for a way to properly use/include both PHP and JS code into the site.

    I'll be happy to assist you with that so would you please address my questions above and also check FTP user settings so it would give an access to the site files (so I could check them)?

    Best regards,

    • Adam Boa
      • New Recruit


      Sorry for the FTP account, I have changed its root directory now.
      To change the directory, I had to change the password as well. Can I post it here? I'm not sure if this is a private discussion.

      Also, my issue is that I want to insert custom JS code on every page without leaving the wp dashboard to save me time.
      I do not want to use a file manager plugin as that is considered a security threat.
      This plugin was a great solution for a couple weeks, but yesterday I noticed that it was conflicting with Hummingbird.


  • Predrag Dubajic
    • Support

    Hi Vilmos,

    I was doing some tests on my installation and I'm kinda unsure about what exactly you are doing so I would appreciate some further information if you don't mind.

    So, I was testing this by adding new jquery code on my test site with "Custom CSS and Javascript" plugin but it all worked fine and there were no issues with using CDN.

    This is the part that confuses me:

    the problem is that Hummingbird takes one of its source files to the CDN and just uploads the PHP code as if it was JS.

    Are you saying that HB uploads one of the "Custom CSS and Javascript" plugin PHP files and treats it as JS?
    The file from the screenshot in the original post doesn't seem like plugin file to me, it's actually a main index.php file from WordPress root folder.

    So I don't quite understand why is this being re-added via JS?

    Is there any specific reason you're not using FTP and child theme or mu-plugin to add additional PHP code to your site?

    Sorry for the FTP account, I have changed its root directory now.
    To change the directory, I had to change the password as well. Can I post it here? I'm not sure if this is a private discussion.

    It seems that WP admin is not working anymore as well, it says that the password is wrong.
    Forums are public so please don't share any sensitive information here.
    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:

    Subject: "Attn: Predrag Dubajic"
    - Site login URL
    - WordPress admin username
    - WordPress admin password
    - FTP credentials (host/username/password)
    - Folder path to site in question
    - Link back to this thread for reference
    - Any other relevant urls/info

    Best regards,

  • Adam Boa
    • New Recruit

    Dear Predrag,

    I am sorry, the FTP account was linking to the old website, but I changed that now and everything seems to be working.
    As for the WP-Admin, I gave that user full administrator access.

    I do not want to add PHP code using plugins, only JS and CSS. Whenever I have to add PHP I try to use the functions.php file.

    In this case what was happening is that I started to use this plugin for adding JS, and after a while I noticed a console error that there is an unexpected < char in one of the Hummingbird CDN files.
    I looked at it and saw PHP code - which is just a wordpress index.php file as you later pointed out - so I started to think that somehow there is a conflict between the Custom JS and the Hummingbird plugins, so I looked for my custom JS code I was trying to add using resources search (CTRL+SHIFT+F from console window) and I couldn't find it at all.

    This leads me to think that the Custom JS plugin stores the JS code in the database, and generates a JS file each time from that, but somehow Hummingbird cached the PHP file that is supposed to fetch the JS from the database instead of the actual JS code. Do you think that is possible?
    Thank you,

  • Predrag Dubajic
    • Support

    Hi Vilmos,

    Thanks for the updated details, I was doing some further testing and after some time I was able to replicate the issue.

    I've then enabled Force load file after content has loaded for "hm_custom_js" and that worked for me, so I did the same thing on your installation and it seems it's working fine there now as well.

    Can you please check and confirm if this works properly now?

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.