Let's Talk!

(480) 580-4738

Logo of Boreas Digital Media, a digital marketing agency offering Website Design and SEO Services to small and mid-sized businesses in Tucson, Arizona
How to Avoid Console Errors in Oxygen Builder When Embedding Gravity Forms

How to Avoid Console Errors in Oxygen Builder When Embedding Gravity Forms

By Jose Roman
Aug 02, 2025

If you've ever tried to embed a Gravity Forms shortcode inside a page built with Oxygen Builder, you may have encountered an error in the Oxygen editor itself, as well as a series of annoying errors in the JavaScript console.

These don't break their place in the frontend, but they definitely make editing in Oxygen a headache… or at least not as pleasant as it should be.

Errors like:

  • Uncaught SyntaxError: Identifier 'gformIsSpinnerInitialized' has already been declared
  • gform_theme_config is not defined
  • net::ERR_NAME_NOT_RESOLVED (from via.placeholder.com)

These console errors can disrupt the editing experience, confuse even experienced users, and slow down the workflow. Fortunately, there are multiple ways to prevent this problem. This guide will walk you through the best solutions available—whether you're a non-coder or a seasoned WordPress developer.

Console Errors caused by Gravity Forms scripts in Oxygen Builder

The first three solutions do require at least some basic coding knowledge or familiarity with WordPress development. But don’t worry—if you're less experienced, have minimal programming skills, or simply prefer to avoid code altogether, Solution 4 is definitely the easiest and safest option.

Why This Happens

Gravity Forms loads JavaScript and CSS assets automatically when its shortcode is rendered. Oxygen Builder's visual editor tries to render the shortcode in real-time, which causes Gravity Forms scripts to load in the builder environment, where they don't belong. The result: script conflicts, double declarations, and missing references.

Gravity Forms error showed on Oxygen Builder editor screen

Solution 1: Disable Gravity Scripts in Oxygen (PHP Snippet)

Best for: Developers with access to functions.php or similar

This approach prevents Gravity Forms from injecting its scripts into the builder. Paste this snippet into your theme’s functions.php file or use a snippets plugin:

add_action( 'gform_enqueue_scripts', 'boreas_remove_gf_scripts_in_oxygen', 11, 2 );
function boreas_remove_gf_scripts_in_oxygen( $form, $is_ajax ) {
    if ( defined( 'OXYGEN_BUILDER_PATH' ) && is_admin() && isset( $_GET['ct_builder'] ) ) {
        remove_filter( 'gform_pre_render', array( 'GFFormDisplay', 'maybe_add_form_css' ) );
        remove_filter( 'gform_pre_render', array( 'GFFormDisplay', 'maybe_add_init_script' ) );
        remove_filter( 'gform_register_init_scripts', array( 'GFFormDisplay', 'add_init_script' ) );
    }
}

You can use the code as it is or replace the function's name for your own one.

Pros:

  • Keeps form visible in the builder
  • Prevents script conflicts

Cons:

  • Requires basic knowledge of PHP
  • Best used in a child theme or via a safe method like a snippets plugin

Solution 2: Conditional Rendering with $_GET['ct_builder']

Best for: Advanced setups or reusable templates

This technique uses PHP to check if Oxygen Builder is active. If so, it skips rendering the form entirely.

if ( ! isset( $_GET['ct_builder'] ) ) {
    echo do_shortcode('your_gravity_forms_shortcode');
}

You can add this in a Code Block element or a reusable component, and customize the Gravity Forms shortcode as needed.

Pros:

  • Great for templates or dynamic pages
  • Maximum control

Cons:

  • Requires some coding and logic

Solution 3: Use a Snippet Plugin

Best for: Admins without FTP access

If you can't or don't want to edit functions.php directly, use a plugin like Code Snippets. It allows you to safely add the PHP code above from the WordPress dashboard.

Pros:

  • Safer and easier than editing theme files
  • Works across themes and Oxygen templates

Cons:

  • Slightly more overhead than manual edits

Solution 4: Use "Do Not Render in Oxygen" (Easiest Fix)

Best for: Visual builders and non-coders

This is the method I personally use, and it works like a charm. Here’s how:

  1. In Oxygen, add a Shortcode element to your page.
  2. Paste your Gravity Form shortcode.
  3. In the settings panel of that shortcode element, check the box: Do not render in Oxygen.
  4. (Optional) Assign the space you want the placeholder to occupy on the screen. This helps you to work out the layout of your page knowing the space the form will occupy on the frontend.
No render option enabled in Oxygen Builder

Done! Now Oxygen will render a placeholder in the editor, and the actual form will load perfectly on the frontend.

Pros:

  • No code required
  • Fully compatible with Oxygen
  • Prevents all script-related errors

Cons:

  • You won't see the form in the visual editor (but that’s a small tradeoff)

FAQ: Gravity Forms Errors in Oxygen Builder

Why does Gravity Forms break Oxygen Builder’s editor?

Gravity Forms injects JavaScript and CSS when its shortcode is rendered. Oxygen Builder tries to render this shortcode inside the visual editor, leading to script conflicts, duplicate variables, and console errors that affect the editing experience.

Will Gravity Forms still work on the frontend if I disable rendering in Oxygen?

Yes, disabling rendering in Oxygen only affects the builder interface. The form will still load and function correctly on the live frontend of your website.

Do I need to modify my theme files to fix this issue?

Not necessarily. While some solutions involve adding PHP snippets to your theme, you can also use a no-code solution with the “Do not render in Oxygen” option or use a plugin like Code Snippets to insert code safely.

What is the easiest way to fix Gravity Forms console errors in Oxygen?

The easiest fix is to insert the Gravity Forms shortcode in a Shortcode element and check the “Do not render in Oxygen” option. This prevents script conflicts without touching any code.

Final Thoughts

If you're looking for quick and safe implementation without touching code, scroll back and try Solution 4. It’s the one I use and recommend to non-technical users.

For developers or agencies managing more complex sites, the PHP-based solutions offer more flexibility.

This issue is a good example of why it's important to understand how plugins interact behind the scenes. With the right tools and a little knowledge, you can keep your editing environment clean and productive.

Boreas Digital Media Logo white

(480) 580-4738

2615 N Goyette Ave
Tucson AZ, 85712

Boreas Digital Media is a marketing agency specializing in custom WordPress websites and SEO for small and mid-sized businesses in the U.S. and Europe.

©2019-2025 Boreas Digital Media LLC. All Rights Reserved. Built and Powered with ♥ by Us.
menuchevron-downcross-circle