Title: Bug | V3.4.0 | Cannot Save Snippet | Error Code 403
Last modified: June 15, 2023

---

# Bug | V3.4.0 | Cannot Save Snippet | Error Code 403

 *  Resolved [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/)
 * Good Day,
 * Upon updating your plugin from V3.3.0 to V3.4.0, there are cases when we cannot
   save our code snippets.
 * For example, when we attempt to create a code snippet to add JavaScript to our
   website header via a PHP code snippet, we get the error:
 * `Could not create snippet. Request failed with status code 403`
 * To replicate our issue, try to create a JS code snippet using the information
   [provided here](https://wordpress.org/support/topic/adding-html-css-javascript-and-php-codes/).
 * Result: [https://prnt.sc/kTKEzKLvwclx](https://prnt.sc/kTKEzKLvwclx)
 * As part of our troubleshooting, we disabled all other plugins and downgraded 
   our PHP from 8.2.7 to 7.4.33.
 * When we downgrade to V3.3.0, we do not have this issue.
 * Also, it appears others have reported the same issue as [noted here](https://wordpress.org/support/topic/latest-3-4-0-ajax-bug-cannot-save-snippets-403-error/).
 * Fix appreciated.
 * Thank you!

Viewing 15 replies - 1 through 15 (of 31 total)

1 [2](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/2/?output_format=md)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16822270)
 * [@generosus](https://wordpress.org/support/users/generosus/) Can you please not
   cross post your topic in replies to other topics? That does not help anyone and
   I archived that reply.
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16822276)
 * Hey [@jdembowski](https://wordpress.org/support/users/jdembowski/),
 * Got it. From my point of view, thought it would help. Won’t happen again.
 * Cheers 🙂
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16823742)
 * Hi [@generosus](https://wordpress.org/support/users/generosus/),
 * It seems likely this has to do with mod_security or similar blocking the code
   in the request.
 * We’re working on a potential fix to hopefully get around this.
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16824624)
 * Hi [@bungeshea](https://wordpress.org/support/users/bungeshea/),
 * Thanks for the quick reply. Yeah, that seems to be the issue.
 * This is the Console Error we’re getting: [https://prnt.sc/yjEjjcD1fuWg](https://prnt.sc/yjEjjcD1fuWg)
 * Most likely, these are the plugin changes that are causing the issue: [https://prnt.sc/n5c-UdCsXzs7](https://prnt.sc/n5c-UdCsXzs7)
 * Not an expert here, but it appears your new REST API endpoints are being blocked
   by WordPress, host servers, CDNs, and/or security plugins.
 * We’ll keep investigating as well.
 * Looking forward to your fix 🙂
 * Thank you!
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16824673)
 * **Update:**
 * So, we may have found the culprit: Cloudflare.
 * It does not like your code change. A Cloudflare Rule ID is blocking your plugin’s
   requests.
 * Details: [https://prnt.sc/3gNyy0oDLNAs](https://prnt.sc/i1ZmingqA5Dm)
 * Cheers 🙂
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16824756)
 * Ah, I thought it must be something like this. Thank you for getting to the bottom
   of the cause, I really appreciate it.
 * I’m going to try adding a feature in the upcoming patch which escapes special
   characters in the code in an attempt to get CloudFlare, mod_security, etc to 
   ignore things like script tags which it’s clearly picking up.
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16824822)
 * Hey [@bungeshea](https://wordpress.org/support/users/bungeshea/),
 * That’s great. Thank you.
 * Please know that — just now — we created a Cloudflare WAF rule to bypass (or 
   whitelist) the URI path generated by your plugin hoping that would fix the issue.
   Details: [https://prnt.sc/fT4HGM3Py1dp](https://prnt.sc/fT4HGM3Py1dp)
 * Unfortunately, the issue remains. We still couldn’t create a Code Snippet that
   adds (or modifies) JS code.
 * Based on the above, there are definitely other sources that are blocking the 
   path.
 * Hope this helps a bit.
 * Cheers 🙂
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16857836)
 * **Update:**
 * We just updated your plugin to V3.4.1. This issue is partially fixed.
 * Specifically, when we try to create — for example — the test snippet provided
   below, we have to click “Save Changes” twice in order for the snippet to save.
   Otherwise, we still get the 403 Error.
 * **Details (1st Time We Click “Save Changes”): **[https://prnt.sc/KH1IaBpm3ynH](https://prnt.sc/KH1IaBpm3ynH)
 * **Details (2nd Time We Click “Save Changes”):** [https://prnt.sc/WXfBzsc_0wC3](https://prnt.sc/WXfBzsc_0wC3)
 * Is this happening to you as well?
 * Thank you 🙂
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16858090)
 * **Update (One More):**
 * Just in … Cloudflare is still blocking your plugin 🙁
 * **Details:** [https://prnt.sc/Cd2nRzFqKNZr](https://prnt.sc/hTDzBKbx5yRv)
 * Cheers 🙂
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16858155)
 * Ah, that’s annoying to hear. Is this happening with all snippets, or only certain
   ones?
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16858193)
 * Hey [@bungeshea](https://wordpress.org/support/users/bungeshea/),
 * So, additional testing was performed. We are using the sample snippets [provided here](https://wordpress.org/support/topic/adding-html-css-javascript-and-php-codes/).
 * When we attempt to create a test code snippet using the CSS snippet provided 
   in the above link, we have no issues.
 * However, when we attempt to create a test code snippet using the JS snippet provided
   in the above link, we have the issue reported.
 * We can get the JS snippet to save only after clicking “Save Changes” twice because
   the first time, Cloudflare blocks the XSS attempt at first, then it’s skipped
   the second time due to the Cloudflare “skip” rule we created.
 * **Details:** [https://prnt.sc/e9JruUs7V4-i](https://prnt.sc/e9JruUs7V4-i)
 * So, in short, the issue lies with Cloudflare blocking your JS-type snippets (
   other sources could be blocking them as well). Going back to V3.30 solves this
   issue.
 * If you don’t have a Cloudlfare account (free), I highly recommend creating one
   for testing purposes and to confirm/replicate our issue.
 * Thank you!
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16870202)
 * [@generosus](https://wordpress.org/support/users/generosus/) Could you stop cross
   posting into other people’s topics please?
 * I cleaned up that other topic.
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16870232)
 * Hey [@jdembowski](https://wordpress.org/support/users/jdembowski/),
 * Got it. Please accept my sincere apologies. I was simply responding to the plugin
   author’s (@bungeshea’s) question in that topic. A trick question 😊
 * Cheers.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16871033)
 * Thank you for your response [@generosus](https://wordpress.org/support/users/generosus/).
   We’re definitely going to need to look into doing some more extensive testing
   with Cloudflare, to see if we’re able to find a workaround for this issue.
 * If it’s possible to provide a rule that excludes a specific URL from false positives,
   then I can see that being a viable solution.
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/#post-16871781)
 * Hey [@bungeshea](https://wordpress.org/support/users/bungeshea/),
 * Thank you. Yes, Cloudflare is definitely blocking code snippets that include 
   XSS code. Our WAF “whitelisting” rule is our temporary workaround. A permanent
   fix is needed. You should be able to replicate the issue once you connect your
   test website(s) to Cloudflare.
 * Cheers 🙂

Viewing 15 replies - 1 through 15 (of 31 total)

1 [2](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/2/?output_format=md)

The topic ‘Bug | V3.4.0 | Cannot Save Snippet | Error Code 403’ is closed to new
replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 31 replies
 * 11 participants
 * Last reply from: [generosus](https://wordpress.org/support/users/generosus/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/bug-v3-4-0-cannot-save-snippet-error-code-403/page/3/#post-17533401)
 * Status: resolved