Skip to content

Instantly share code, notes, and snippets.

@maddisondesigns
Last active September 23, 2026 13:30
Show Gist options
  • Select an option

  • Save maddisondesigns/276af3c3781cde053c4855cd1da37cac to your computer and use it in GitHub Desktop.

Select an option

Save maddisondesigns/276af3c3781cde053c4855cd1da37cac to your computer and use it in GitHub Desktop.
Disable AI Support and Remove Connectors Screen in WordPress
/**
* Redirect the new AI Settings > Connectors screen back to the Dashboard so it can't be accessed
*/
function mytheme_admin_redirects() {
global $pagenow;
/* Redirect Connectors screen back to main Dashboard page */
if( $pagenow == 'options-connectors.php' ) {
wp_redirect( admin_url( '/' ), 301 );
exit;
}
}
add_action( 'admin_init', 'mytheme_admin_redirects' );
/**
* Remove the new AI Settings > Connectors page from the WP Dashboard menu
*/
function mytheme_remove_connectors_screen() {
remove_submenu_page( 'options-general.php', 'options-connectors.php' );
}
add_action( 'admin_init', 'mytheme_remove_connectors_screen' );
// Disable AI Support
define( 'WP_AI_SUPPORT', false );
@Orochikyocr

Copy link
Copy Markdown

Thanks for this. It is annoying how hard they are pushing AI trash.

@maddisondesigns

Copy link
Copy Markdown
Author

Thanks for this. It is annoying how hard they are pushing AI trash.

No worries πŸ‘
And agreed! Last thing I want in my site is AI!

@pixelsandthings

Copy link
Copy Markdown

Thanks for this.

@maddisondesigns

Copy link
Copy Markdown
Author

Thanks for this.

πŸ‘ Glad you find it useful :-)

@ianpegg

ianpegg commented Jun 12, 2026 •

Copy link
Copy Markdown

In case anyone finds it useful, I've refactored @maddisondesigns code to utilise the WP_AI_SUPPORT constant - unless this constant is both defined and set to true, the AI settings screen will be removed from the WP 7+ dashboard:

/**
 * Removes AI support from WordPress 7+:
 * @link https://gist.github.com/maddisondesigns/276af3c3781cde053c4855cd1da37cac
 *
 * @return void
 */
add_action('admin_init', function() {
    if (defined('WP_AI_SUPPORT') && constant('WP_AI_SUPPORT')) {
        return;
    }

    global $pagenow;

    /**
     * Removes the new Settings > Connectors AI screen from the WP
     * Dashboard menu:
     */
    remove_submenu_page('options-general.php', 'options-connectors.php');

     /**
     * Redirects the new Settings > Connectors AI screen back to the main
     * Dashboard so the URL can't be accessed directly:
     */
	if ('options-connectors.php' === $pagenow) {
		wp_redirect(admin_url('/'), 301);
		exit;
	}
});

@pixelsandthings

Copy link
Copy Markdown

You can also use the filters - (Apparently Jetpack if installed can override the WP baseline setting):

add_filter( 'wp_supports_ai', '__return_false' );
add_filter( 'jetpack_ai_enabled', '__return_false' );

Setting via constant will override both.

@BrookeDot

Copy link
Copy Markdown

while not directly related to AI, Akismet also uses the connector interface and it can be overridden with:

/**
 * Disable Akismet Connector Usage
 */
     add_action(
		'wp_connectors_init',
			function ( $registry ) {
				if ( method_exists( $registry, 'is_registered' ) && $registry->is_registered( 'akismet' ) ) {
					$registry->unregister( 'akismet' );
				}
			},
		20
	); // after Akismet_Connector::register_connector (default priority 10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment