Use the code LIFETIME at checkout and get 20% off our limited-time lifetime plans. Offer available until September 21.
WPCodeBox Documentation
< All Topics
Print

How to target the Oxygen Builder UI using the condition builder

How not to run a Code Snippet in the Oxygen Builder UI

In case you don't want to run a Code Snippet in the Oxygen Builder UI, you need to use the Page URL Condition. The Oxygen editor pages have a ct_builder=true in the URL. So, to not run a snippet in the Oxygen UI or in the Oxygen iframe, we can set a condition like this:

Page URL Doesn't contain ct_builder=true

How to run a Code Snippet only in the Oxygen Builder UI

To run a Code Snippet in the Oxygen Builder UI, we would do the same as above, but use the Contains verb instead of Doesn't contain.

To run code snippet only in the Oxygen Builder iframe (that's the area of the page that's rendered inside the Oxygen Builder) we can use oxygen_iframe=true instead of ct_builder=true.

Combining these conditions

These conditions can be combined using other conditions or condition groups to achieve more complex conditional logic. For example you can run snippets in the Oxygen builder context only on certain pages or post types.

Previous How to enable maintenance mode with 2 clicks using WPCodeBox