-
-
Save dexit/a18743bee194e679d0c0083cadbfdf4b to your computer and use it in GitHub Desktop.
Remove Elementor AI including the silly per user checkboxes like "Enable Elementor AI functionality"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function disable_elementor_ai_module() { | |
| if ( class_exists( 'Elementor\Plugin' ) && isset( \Elementor\Plugin::$instance->modules_manager ) ) { | |
| $modules_manager = \Elementor\Plugin::$instance->modules_manager; | |
| // Disable AI module entirely by removing its registration | |
| remove_all_actions( 'personal_options' ); | |
| remove_all_actions( 'personal_options_update' ); | |
| remove_all_actions( 'edit_user_profile_update' ); | |
| // Disable AI option across all users | |
| add_filter( 'pre_update_user_option_elementor_enable_ai', '__return_false' ); | |
| add_filter( 'default_option_elementor_enable_ai', '__return_false' ); | |
| // Remove any instance of the AI module within Elementor | |
| if ( isset( $modules_manager->modules['ai'] ) ) { | |
| unset( $modules_manager->modules['ai'] ); | |
| } | |
| } | |
| } | |
| add_action( 'elementor/init', 'disable_elementor_ai_module', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment