Troubleshooting: Beaver Builder hangs every time I click Publish or Save

When you make edits to a Beaver Builder layout and find that Publish or Save consistently hangs, it may be because of a mod_security issue on your hosting server.

Usually (though not always), this happens when you add some custom code to one of your modules, such as adding an <iframe> or <script> tag, but it has even been triggered by using the word select in a Text module.

Technical details

Mod_security is an Apache module that serves as a web application firewall. When you save or publish a page, a POST object is sent to the admin Ajax, and it is scanned by modsec if mod_security is enabled. Tags like <iframe> and <script> (non-UTF-8 characters) or words like select, which Is a keyword used in MySQL queries, can be interpreted as a security threat and produce a 403 or 406 error in Ajax, causing the Save or Publish to hang.

You can find out whether your hosting server is using mod_security by asking your hosting provider or, if you know PHP, by using phpinfo().  Note that a 406 error usually indicates that mod_security is in use.

Solution

Try adding the following line to the wp-config.php file in your WordPress home directory:

define( 'FL_BUILDER_MODSEC_FIX', true );

This line causes the request to be base64-encoded so modsec sees the offending tags and text as binary data and allows it to pass through.

This line can go in a child theme functions.php in some cases, but we do recommend that you put it in wp-config.php. If you've tried adding it to  wp-config.php and functions.php in your child theme and it doesn't resolve the issue, contact your hosting provider or Beaver Builder Support.