Find out why your code or HTML did not save and who makes the change
TermsFeed AutoTerms keeps the old code, or removes the HTML you added, when your WordPress account lacks the unfiltered_html capability. unfiltered_html is the WordPress permission to add JavaScript, CSS, and HTML that WordPress does not filter.
After it filters a code field, or a text field of the Cookie Consent kit, the plugin shows 1 of these messages at the top of the screen.
| Message | What the plugin did |
|---|---|
| "Your account is not allowed to add JavaScript or CSS code (the "unfiltered_html" capability is required), so the previous code was kept." | Kept the stored code and discarded your change |
| "Your account is not allowed to add HTML (the "unfiltered_html" capability is required), so it was removed from the changed text." | Saved your text without its markup |
Which plugin settings need unfiltered_html
Every code setting needs unfiltered_html: the Callbacks, Additional CSS, vendor scripts, and Configuration Parameters. Without it, the texts of the Cookie Consent kit save without their markup, with the second message. The notice bar messages keep only the HTML that a WordPress post allows, with no message.
A developer checks the account with WP-CLI, replacing 1 with the user ID. The command prints bool(false) for an account without the capability.
wp eval 'var_dump( user_can( 1, "unfiltered_html" ) );'
Cause 1: You are a site Administrator on a multisite network
WordPress gives unfiltered_html only to Super Admins on a multisite network, so a site Administrator does not save new code in the plugin settings.
Open the My Sites menu in the toolbar. A menu without the Network Admin item means your account is a site Administrator.
Send the code to a Super Admin of the network, and ask the Super Admin to save it on the plugin screen of your WordPress website. Read what else changes on a network in WordPress Multisite Legal Pages.
Cause 2: wp-config.php sets DISALLOW_UNFILTERED_HTML
The WordPress constant DISALLOW_UNFILTERED_HTML removes unfiltered_html from every user, Administrators included. The plugin then keeps the old code for every account, with the first message.
Open wp-config.php and search for the line define( 'DISALLOW_UNFILTERED_HTML', true );.
Ask the developer or host who manages wp-config.php to make the change.
- Temporarily set the constant to
falseonly where your security policy allows it. - Ask an Administrator to save the code in the plugin.
- Set the constant back to
true, which keeps the saved code in place.
Cause 3: A security plugin removes the capability
Some security or hardening plugins offer an option that turns off unfiltered HTML, and where that option removes unfiltered_html from Administrators, it blocks their code saves as the constant does. Check in the documentation of your security plugin whether it sets DISALLOW_UNFILTERED_HTML or removes the capability from the role.
The WP-CLI user_can check returns bool(false) for an Administrator while the option is on.
- Temporarily turn off the option in the security plugin.
- Save the code in the AutoTerms plugin.
- Turn the option on again.
Cause 4: Your account has a legal pages role without unfiltered_html
A user with the plugin capabilities and without unfiltered_html saves legal pages with their HTML filtered, as WordPress does for any post. Markup that a post does not allow, such as a <script> or an <iframe>, disappears from the legal page on save, with no plugin message. The TermsFeed menu of that user does not list Compliance Kits or Settings.
Ask an Administrator, or a Super Admin on a network, to add the markup or the code. Give the user unfiltered_html only where you trust that user with code on every page of your WordPress website. Follow the role steps in WordPress Admin Menu Missing.
How to verify that the plugin saved your code or HTML
- Save the code from an account with
unfiltered_htmland confirm that neither message appears. - Reload the screen and confirm that the code is still there.
- Clear the page cache, close every private window, and load your WordPress website in a new one. Open the page source with Ctrl+U (Cmd+Option+U on a Mac) and search for the code.
- Confirm that the code matches what you saved, such as the callbacks in the script with the id
termsfeed-autoterms-cookie-consent-callbacksor the CSS intermsfeed-autoterms-cookie-consent-style.