Review and change WPBakery Page Builder settings

MaintenanceAdvanced~10 min

Before you start

Plugin version 1.12.0 or newer with WPBakery Page Builder active, from an administrator connection: both tools need the manage-options capability. Update WPBakery settings is a destructive write and starts off. The global CSS and JS fields also need a user who may post unfiltered HTML.

WPBakery’s settings screen decides a lot that is easy to forget: which of its loading modes (hybrid, optimized or legacy) its CSS and JS use, whether Google Fonts come from Google or your own server, and which sitewide CSS gets added on top of every page. When a speed test or a privacy review raises one of these, you want the current value in front of you first.

This prompt reads the settings and changes only what you name.

The prompt
Read this site's WPBakery settings with wpbakery-get-settings. Show me
css_loading, js_loading, local_google_fonts, google_fonts_subsets, the post
types WPBakery's editor is on for, and whether any global custom CSS is set.
Change nothing yet, and tell me which settings have no stored value.
I want [local_google_fonts on] and [css_loading set to optimized]. Show me
each current value beside the new one and wait for my go. Then write only
those two with wpbakery-update-settings, and give me the previous values from
the response so I can switch them back.

Why this is safe to run

The read covers a fixed list of settings, and the global header and footer JS come back only for a user who may post unfiltered HTML. The license code is never returned.

The write runs each value through WPBakery’s own sanitize callback for that field and refuses a value the callback would change, so what you approved is what gets stored. The global custom_css is checked separately: CSS holding markup, or a < followed by another character where WPBakery would cut custom.css off, is refused. A value equal to what is stored is left alone.

These settings apply to the whole site at once, which is why the update starts off and is marked destructive. The previous values in the response are the undo. It needs the manage-options capability, so a limited agent user never reaches it, and the call is in the Activity Log.

Already connected? From an admin connection, ask your agent for the “review and change WPBakery settings” recipe, say which settings you want changed, and it runs the same read-first flow on your own site.

How it works

  1. Read the WPBakery settings on the fixed list, with the post types its editor is on for and its version.
  2. Show the current value of each setting you want to change.
  3. Wait for your approval of the exact new values.
  4. Write them in one call and keep the previous values it returns.
  5. Check the custom.css rebuild when the global CSS changed.

Questions

Which settings can it change?
not_responsive_css, local_google_fonts and shortcuts as true or false, google_fonts_subsets as a list, css_loading and js_loading as hybrid, optimized or legacy, and the global custom_css, custom_js_header and custom_js_footer. The Gutenberg switch, auto save and Design Options use can be read but not written, and the license code is never returned.
How do I undo it?
The write returns the old value of every setting that changed as previous, null where none was stored, and sending those back is the way back. WPBakery settings changes are not in the Changes tab.
What happens to custom.css?
Writing custom_css makes WPBakery rebuild its custom.css file, and the call reports an error when the file does not match afterwards. The setting keeps your CSS as sent, while WPBakery points each url(../ in the file it builds at its own assets folder.