Fix “Call to a member function get_component() on null” in Elementor AI module

Getting a fatal error like this?

Uncaught Error: Call to a member function get_component() on null in wp-content/plugins/elementor/modules/ai/module.php:442

This comes from the Elementor AI module. When another plugin or theme calls wp_enqueue_media(), Elementor attaches its AI Media Library feature. In some versions, the AI module tries to talk to an internal “AI app” object that is still null, so PHP crashes.

The usual pattern is:

  • A recent Elementor update triggered the bug.
  • Another plugin or the theme calls wp_enqueue_media() on the front end or in a custom screen.
  • The AI module runs too early and calls get_component() on a null object.

The good news. Your content and designs are safe. This is a logic bug in the AI integration and a plugin conflict. Below is a safe path to get your site back, fix Elementor, and find the plugin that triggers the crash.

Elementor is throwing this fatal error:

Uncaught Error: Call to a member function get_component() on null in wp-content/plugins/elementor/modules/ai/module.php:442

It looks related to the AI module and the media library. How do I fix this without breaking my site?

Short version

Elementor AI attaches itself to the WordPress media library.

When any code calls wp_enqueue_media(), Elementor runs its AI Media Library hook. In affected versions, that hook tries to get an internal “AI app” object, then calls get_component() on it. If the AI app is not initialized yet, that object is null and PHP stops with this fatal.

You usually fix this by:

  • Updating Elementor (and Elementor Pro, if used) to the latest stable version.
  • Turning off the “Build with AI” feature so the AI module does not hook in.
  • Finding any plugin or theme that calls wp_enqueue_media() and triggers the AI code, then updating or adjusting that plugin.
  • Rolling Elementor back one version as a temporary workaround if needed.

Quick path – pick your situation


Step 0. Get your site or editor back online

If you can still open wp admin:

  1. Go to Plugins → Installed Plugins.
  2. Deactivate Elementor (and Elementor Pro if you use it).

Your site front end may look different while Elementor is off, but the fatal should stop and you can work again.

If you cannot reach wp admin at all:

  1. Open your hosting file manager or connect with SFTP.
  2. Go to wp-content/plugins/.
  3. Rename the elementor folder to elementor-disabled.
  4. If you use Elementor Pro, rename elementor-pro to elementor-pro-disabled as well.
  5. Reload your site and wp admin in a browser.

WordPress will treat those plugins as inactive. You will re enable them after the fix.


Step 1. What this error actually means

The core pattern looks like this:

Uncaught Error: Call to a member function get_component() on null
in wp-content/plugins/elementor/modules/ai/module.php:442

If you see the full stack trace, you will often see:

  • Elementor\Modules\Ai\Module->get_ai_app()
  • Elementor\Modules\Ai\Module->get_ai_connect_url()
  • Elementor\Modules\Ai\Module->enqueue_ai_media_library()
  • do_action('wp_enqueue_media')
  • Then a plugin or theme file that called wp_enqueue_media()

So:

  • A plugin or theme calls wp_enqueue_media() to load the media modal.
  • Elementor AI listens to that event to inject its “Generate with Elementor AI” button.
  • Inside that process, Elementor tries to talk to its AI app object.
  • That object is still null in some contexts, so get_component() throws the fatal.

It is a bug or edge case in the AI module combined with how another plugin or screen uses the media library.

Your goal is to:

  • Get on a version of Elementor where the bug is fixed.
  • Reduce how often the AI module runs.
  • Find any plugin that keeps triggering this hook and update or adjust it.

Step 2. Update Elementor and WordPress correctly

First make sure you are not stuck on the exact version that introduced the bug.

2.1 Update everything normally

In wp admin:

  1. Go to Dashboard → Updates.
  2. Update WordPress core to the latest stable version.
  3. Update Elementor and Elementor Pro (if used) to their latest versions.

The Elementor team has released fixes for several AI module issues in point releases. In some cases, moving from the first release of a major version to the next minor update is enough to stop this fatal.

2.2 If the update itself caused the crash

If the error started right after updating Elementor and you cannot keep that version yet, use Elementor’s built in rollback as a temporary workaround.

  1. In wp admin, go to Elementor → Tools → Version Control.
  2. Under Rollback Version, choose the previous stable version.
  3. Click Reinstall and confirm.
  4. Repeat for Elementor Pro if you use it, so both match.

Always have a backup before rolling back. This is a temporary fix to get you stable while waiting for a newer patched version.

After updating or rolling back, re activate Elementor if you disabled it in Step 0 and test again.

If the fatal is gone already, you can skip ahead to Verification. If it is still there, continue.


Step 3. Turn off Elementor AI features

Even if you like AI features, it is wise to turn them off while you troubleshoot. This stops the AI module from attaching to the media library in most places.

Disable “Build with AI” in Elementor settings

  1. In wp admin, go to Elementor → Settings → Features.
  2. Find the feature called Build with AI or similar.
  3. Set it to Inactive or uncheck it.
  4. Click Save Changes.

This removes the core AI integration hook for many screens.

If you want to go further and hide AI buttons for specific users, Elementor’s docs also explain turning off AI notifications per user profile. For pure stability though, the Features screen is the main one you want.

After turning it off, clear any caching plugin and reload the page that used to crash.

If the fatal is gone, you can leave AI off or later re enable it after Elementor announces a fix for your specific version.

If the fatal still appears, it is time to see which plugin or theme is triggering the AI module.


Step 4. Find the plugin or theme that triggers the AI media hook

In many reports, the stack trace shows another plugin calling wp_enqueue_media() when the error occurs. Examples include SEO plugins and hosting partner plugins.

You want to know which plugin or theme file appears right before or after the wp_enqueue_media() call in the error log.

4.1 Enable debug log and reproduce

If you do not already have a debug log:

  1. Edit wp-config.php and make sure these lines exist above the “That is all” comment:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
  1. Save the file.
  2. Trigger the error again. For example, open the page or editor that fails.
  3. Download wp-content/debug.log via FTP or the file manager.

4.2 Read the stack trace

Search the log for get_component() on null or modules/ai/module.php. Look at the lines around it.

You should see a path like one of these:

  • wp-content/plugins/some-plugin/.../something.php
  • wp-content/themes/your-theme/.../something.php

near a call to wp_enqueue_media().

That file is the piece of code that calls the media uploader, which then triggers Elementor’s AI hook.

4.3 Test the suspected plugin or theme

Once you see a plugin name in the stack trace:

  1. In wp admin, go to Plugins → Installed Plugins.
  2. Temporarily deactivate that plugin.
  3. Try the same action again. For example, open the Elementor editor or the page that used to crash.

If the fatal disappears when that plugin is off, you have confirmed a conflict between that plugin and the current Elementor AI module.

Options from there:

  • Update that plugin to its latest version if you have not already.
  • Contact that plugin’s support with the full error log and mention that their use of wp_enqueue_media() triggers the Elementor AI module bug.
  • Keep the plugin disabled on staging until the vendor or Elementor releases a compatibility fix.

If the fatal still appears even with obvious plugins disabled, do a classic conflict test:

  1. Switch to a default theme like Twenty Twenty Four.
  2. Deactivate all plugins except Elementor (and Elementor Pro).
  3. Test again.
  4. Re activate plugins one by one until the fatal returns.

This finds the exact combination that triggers the crash.


Step 5. Advanced: temporarily disable the AI media hook with code

Only use this step if you are comfortable adding a small code snippet. It is a temporary workaround that tells WordPress to remove Elementor’s AI media hook once Elementor has loaded.

Add this via a small custom plugin or a code snippets plugin:

<?php
/**
 * Temporarily disable Elementor AI media library hook.
 */
add_action( 'plugins_loaded', function () {
    if ( class_exists( '\Elementor\Plugin' ) ) {
        $plugin = \Elementor\Plugin::instance();

        if ( isset( $plugin->modules_manager )
            && method_exists( $plugin->modules_manager, 'get_modules' )
        ) {
            $ai_module = $plugin->modules_manager->get_modules( 'ai' );

            if ( $ai_module && method_exists( $ai_module, 'enqueue_ai_media_library' ) ) {
                remove_action(
                    'wp_enqueue_media',
                    array( $ai_module, 'enqueue_ai_media_library' ),
                    10
                );
            }
        }
    }
} );

What this does:

  • Waits until plugins are loaded.
  • Asks Elementor for its AI module if it exists.
  • Removes the AI media library hook from wp_enqueue_media.

This stops Elementor AI from running when other code calls wp_enqueue_media(), so the null get_component() call never happens.

Use this as a band aid on staging first. Long term you still want Elementor and the conflicting plugin updated so you can safely remove the snippet.


Step 6. When to contact Elementor or your host

If you have:

  • Updated or rolled back Elementor as needed.
  • Disabled Build with AI in Elementor settings.
  • Found and tested the conflicting plugin or theme.
  • Optionally added the temporary hook removal snippet.

and the fatal still appears, it is time to open a support ticket.

Include:

  • The full error line and stack trace from debug.log.
  • Your WordPress, PHP, Elementor, and Elementor Pro versions.
  • Which theme you use.
  • A list of active plugins, especially those that integrate with the media library.
  • Which exact screen or action triggers the error.

Send that to:

  • Elementor support if the top of the stack trace is in elementor/modules/ai/module.php.
  • The developer of any plugin that calls wp_enqueue_media() right before the crash.

This gives them the context they need to reproduce and fix the bug on their side.


Verification checklist

You are in good shape when:

  • There are no new entries in debug.log mentioning get_component() on null or modules/ai/module.php.
  • You can open the Elementor editor without a critical error screen.
  • Any screen that opens the media library works normally.
  • If you disabled Elementor AI or added the code snippet, the site behaves as expected without AI features crashing it.

Still stuck?

For AI help

Hit Continue Chat below and send me:

  • The full fatal error text and stack trace from debug.log.
  • Your WordPress, PHP, Elementor, and Elementor Pro versions.
  • A list of your main plugins, especially SEO, media, or hosting helper plugins.
  • Whether the error happens on the front end, in the Elementor editor, or in the Customizer or Appearance screens.

I can help you narrow down which plugin triggers the AI module and suggest a safe combination of updates, settings, and temporary workarounds.

For expert human help

Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.

Need human WordPress help?

WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!