By default, Asset CleanUp Lite/Pro does not trigger when Oxygen’s Visual Builder is on, more precisely when the following query string is in use: ct_builder=true. For instance, you might have an “About Us” page and it’s built using Oxygen. The page builder can be accessed in the front-end via /about-us/?ct_builder=true. While you use the visual page builder, no Asset CleanUp optimization rule takes place including unloading CSS/JS as well as minifying and combining it. The reason behind it is to make sure that the editor will load perfectly fine and none of its assets that are built especially for the visual builder are altered in any way.
There have been plenty of situations when some of the builder’s files were altered (e.g. minified) that ended up in the page builder not loading due to JavaScript errors (visible in the browser’s console) or it was loading, but some of its functionality didn’t work. Thus, it’s best to leave those assets untouched as any optimization is completely irrelevant (mostly for the guest visitor and Google PageSpeed Insights that accesses the website as a visitor).
However, some users, especially developers who work on various websites are experiencing a very slow load of Oxygen’s visual page builder because there are too many plugins loaded on those WordPress websites, which also have lots of CSS/JS that would even interfere with the JS from Oxygen’s editor.
Asset CleanUp can be used to prevent specific plugins that are proven to be slow in loading and irrelevant to load on the page builder, in order to make the editor load faster (e.g. the whole editor could initialize in 2 seconds, rather than in 10 which would add up to the waiting time if it’s often used). This is recommended to be used only when the editor is really slow in loading and by those who really know what they are doing.
The following constant needs to be added to wp-config.php (note that it should be added BEFORE the line where “wp-settings.php” is required):
define('WPACU_LOAD_ON_OXYGEN_BUILDER_EDIT', true); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
The moment this constant is set to true, some of Asset CleanUp’s rules will take effect on the visual page builder which are the rules from the following areas:
- “Plugins Manager” → “IN FRONTEND VIEW (your visitors)” (the Oxygen editor loads in the front-end view, not within /wp-admin/)
- The unload rules set within the “CSS & JavaScript Manager” for the targeted page (in our example /about-us/)
In order to make sure the right RegEx rules are set if you want to unload entire plugins on the editor’s page, you have to make sure to include ct_builder=true in the RegEx. For instance, to match the URI /about-us/?ct_builder=true the following RegEx should be used: #/about-us/\?ct_builder=true# (see the print screen below).
REMEMBER: You can also just use #\?ct_builder=true# to match any page (not only “About Us”) that is having the Oxygen’s visual site builder in use. It should work well in most situations.
What about the templates that are edited?
If you’re editing any template from “Oxygen” -> “Templates” (/wp-admin/edit.php?post_type=ct_template) and you need a matching RegEx for unloading any plugin, then you can use the following one: #/\?ct_template=# – this will match something like /?ct_template=inner-content&ct_builder=true
If you want to include all Oxygen Builder’s pages & templates in just one RegEx rule (not two per line), you could use the following: #(/\?ct_template=|/\?ct_builder=)#