Disable AI Support and Remove Connectors Screen in WordPress

1 min read Original article ↗
/**
* 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' );