• Resolved adammontague

    (@adammontague)


    I’ve noticed an odd occurrence when loading scripts. In my functions file I have a commonly used line like so:

    wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-3.4.1.min.js', array(), '3.4.1', true);
    

    When Wordfence is activated the enqueue parameter for loading in the footer (true) is seemingly ignored, however when I deactivate Wordfence it works as expected.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support WFAdam

    (@wfadam)

    Hello @adammontague and thanks for reaching out to us!

    If this action is working when you disable Wordfence, then I think our first step should be switching the firewall into Learning Mode.

    From the Wordfence Dashboard click on Manage WAF. Then you will see Basic Firewall Options > Web Application Firewall Status. Change the option to Learning Mode. Now perform the actions that were causing issues. This will help Wordfence learn that these actions are normal and it will allow them in the future. After you have finished performing the actions, switch the WAF from Learning Mode back to Enabled and Protecting. Now test to see if these actions work correctly.

    https://www.wordfence.com/help/firewall/learning-mode/ is an amazing resource for learning more about the WAF and learning mode.

    Let me know if this helps!

    Thanks!

    Thread Starter adammontague

    (@adammontague)

    I’m afraid that’s not worked @wfadam

    Plugin Support WFAdam

    (@wfadam)

    Hello again @adammontague

    Your theme or another plugin may not be compatible with WordPress 5.5 due to the change of deprecation for the jQuery Migrate JavaScript library.

    You can install the Enable jQuery Migrate Helper plugin below and see if the Wordfence Live Traffic page loads properly now:
    https://www.ads-software.com/plugins/enable-jquery-migrate-helper/

    Let me know if this helps!

    Thanks!

    Thread Starter adammontague

    (@adammontague)

    Hi @wfadam

    I think there may be some crossed wires here, the Live Traffic page has never been the problem. And this existed before upgrading to 5.5

    I have deregistered WP bundled jQuery and I’m enqueuing my own version of jQuery (v3.4.1) which I wish to be included in the footer of the theme, however with Wordfence activated it gets put in the head. As soon as I deactivate Wordfence the results are as expected and the jQuery file is loaded in the footer.

    Hope that makes sense,
    Cheers!

    Plugin Support WFAdam

    (@wfadam)

    Hello again @adammontague

    I recommend checking for a plugin or theme conflict. To do this, you can disable your other plugins on the site one at a time and test, or alternatively, use the Health Check & Troubleshooting plugin (https://www.ads-software.com/plugins/health-check/). That is a plugin you will need to install from the Plugins > Add New area.
    If you use the Health Check & Troubleshooting plugin, you can troubleshoot the site with just Wordfence enabled and the changes are only seen in the back end and not to visitors.

    After downloading that, in the plugins section under Health Check & Troubleshooting you’ll see “Troubleshoot”. Click that and you’ll be in Troubleshooting Mode, which you will see a Troubleshooting Mode button in the top admin bar, which lets you know you are actively troubleshooting. (Note about that: Clicking Disable Troubleshooting mode in that area will turn off troubleshooting when you’re done testing for the conflict at the end.)

    With Troubleshooting mode active, in the plugins section, you will see Enable while troubleshooting under all your plugins. Click Enable while troubleshooting under Wordfence, and your site on the backend will act as only Wordfence is enabled. Keep in mind, this doesn’t always rule out plugin conflicts, however, it can a good portion of the time.

    Once you enable the troubleshooting with Wordfence, go over to your page and see if you’re seeing the same issue. Also, from the top on the admin bar where we see Troubleshooting Mode. Hover over that with your mouse and check to see if a default theme is selected (if you have one installed). It is also good to rule out the theme. Keep in mind, these changes will not change the way the site looks to visitors.

    If they do continue, then we need to look elsewhere. I would have to check with the team on this issue.

    Let me know what you find!

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_enqueue_script not loading script in footer when Wordfence activated’ is closed to new replies.