JS inserted into notification HTML

I use an external email design tool to create responsive email notification messages. I have also configured a function to disable the normal editor in notifications by conditionally calling add_filter('user_can_richedit', '__return_false'); This keeps the regular editor from kindly rewriting my code.

However, whenever I save the notification GF is inserting a tag into the message “JAVASCRIPT HOOK FUNCTIONS FOR GRAVITY FORMS”

Obviously, I don’t need or want JS in the email. I’ve eliminated other plugins, and my own code I think. Any ideas on how to prevent this from being inserted?

Hi @doxalyst,

I’m unable to replicate the issue described in a default WordPress installation with no other plugins active and using the default WP theme. Make sure that you’re using latest Gravity Forms version (2.9 currently).

If you’re using that version already, I would recommend you to perform a full conflict test following the instructions here: https://docs.gravityforms.com/conflict-testing-using-health-check-plugin/#installing-the-health-check-troubleshooting-plugin

It will allow you to perform the testing easily without affecting your visitors or doing permanent changes to the site. Note that for a valid conflict test, as the documentation explains the first try must be done with only Gravity Forms enabled, all other plugins disabled, and using a default WP theme without custom code (e.g. Twenty Twenty-One).

I’m using the solution I found here: Exclude Gravity Forms Notifications from Classic Editor WYSIWYG [RESOLVED]

If I remove it, the script is not inserted but the visual editor messes up my email’s HTML.

Interestingly, it does not do this with just any plain HTML, just the code I build from MJML and import (responsive email layout.)

Doing a bit of exploration, I think the problem lays with GF’s Dom_Parser reading the notification HTML and determining that the script needs to be inserted into code – except that the insertion point is usually mid-body and not in the even.

Soo… is there a way to tell the DOM_Parser “hands-off” for notification email code??

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.