Title: Error adding JavaScript code to Head
Last modified: February 8, 2024

---

# Error adding JavaScript code to Head

 *  Resolved [logichlan](https://wordpress.org/support/users/logichlan/)
 * (@logichlan)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/error-adding-javascript-code-to-head/)
 * Hi All,
   I am currently being presented with the Wordfence warning “a potentially
   unsafe operation has been detected in your request to this site” when trying 
   to add JavaScript code to the header of our website.Could anyone advise the best
   next steps here?Thanks

Viewing 1 replies (of 1 total)

 *  Plugin Support [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * (@wfpeter)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/error-adding-javascript-code-to-head/#post-17408867)
 * Hi [@logichlan](https://wordpress.org/support/users/logichlan/),
 * If Javascript is being added via a header/footer plugin or custom script, it 
   may be seen as a false-positive.
 * Putting Wordfence in [Learning Mode](https://www.wordfence.com/help/firewall/learning-mode/)
   may help allow the script. 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**. Try loading the page(s) that you were
   having trouble with to teach Wordfence the request is normal and should be allowed
   in future. After your testing, switch the WAF from Learning Mode back to **Enabled
   and Protecting** to see if it continues to work.
 * Thanks,
   Peter.

Viewing 1 replies (of 1 total)

The topic ‘Error adding JavaScript code to Head’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 2 participants
 * Last reply from: [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/error-adding-javascript-code-to-head/#post-17408867)
 * Status: resolved