Culprit: WAF – Web Application Firewall
Sometimes, when I go to save a Snippets plugin code snippet I get an error that reads, “Could not update snippet. Request failed with status code 403.”
For me, the issue is that WAF blocked my snippet code from saving. Here’s how I get my Code Snippet to save.
Disable WAF or Disable Rule by ID
Today, I was working on a site hosted on WPMU Dev hosting. Here’s how I can disable the rule or temporarily disable WAF. I go to Hosting > Logs > WAF Log. I look for the Rule ID (underlined below).
Disable a Rule
Go to Hub > Hosting > Tools > Web Application Firewall > Edit. Scroll down to the area that reads Disabled Rule IDs. Enter your WAF rule ID, one per line and then Save.
You can also temporarily disable the WAF.
Alternatively, you can toggle on or off the Enable WAF option in Web Application Firewall.
Once this is completed, resave your Snippet. Likely, you’ll see that the Snippet was created and activated. Success!