Problem
Code Snippets 3.10.2 can register the same Elementor promotion control twice while loading the Elementor editor. Elementor then reports:
Function Elementor\Controls_Manager::add_control_to_stack was called incorrectly. Cannot redeclare control with same name "code_snippets_promotion_notice_elementor_pro".
The notice occurs with Code Snippets active even when all individual snippets are disabled, and disappears when Code Snippets is deactivated.
Root cause
Plugin::load_plugin() instantiates Promotion_Manager twice on admin requests:
if ( is_admin() ) {
$this->admin = new Bootstrap_Admin();
new Promotion_Manager();
}
// ...
if ( is_admin() ) {
new Promotion_Manager();
}
Each Promotion_Manager creates an Elementor_Editor, which registers another elementor/init callback. Both instances then attach callbacks that add the same code_snippets_promotion_notice_elementor_pro control.
The duplicate initialization is present in the 3.10.2 release and remains present on core and core-beta.
Expected behavior
Promotion_Manager is initialized once per request.
- The Elementor Core and Elementor Pro promotion controls are each registered once.
- Opening the Elementor editor does not produce a duplicate-control notice.
Acceptance criteria
- Remove the duplicate
Promotion_Manager initialization.
- Verify Elementor and Elementor Pro editor loading with Code Snippets active.
- Add regression coverage that prevents the promotion integration from being initialized twice.
Problem
Code Snippets 3.10.2 can register the same Elementor promotion control twice while loading the Elementor editor. Elementor then reports:
The notice occurs with Code Snippets active even when all individual snippets are disabled, and disappears when Code Snippets is deactivated.
Root cause
Plugin::load_plugin()instantiatesPromotion_Managertwice on admin requests:Each
Promotion_Managercreates anElementor_Editor, which registers anotherelementor/initcallback. Both instances then attach callbacks that add the samecode_snippets_promotion_notice_elementor_procontrol.The duplicate initialization is present in the 3.10.2 release and remains present on
coreandcore-beta.Expected behavior
Promotion_Manageris initialized once per request.Acceptance criteria
Promotion_Managerinitialization.