File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -375,6 +375,18 @@ function _unhook_font_registration() {
375375}
376376tests_add_filter ( 'init ' , '_unhook_font_registration ' , 1000 );
377377
378+ /**
379+ * After the init action has been run once, trying to re-register connector settings can cause
380+ * duplicate registrations. To avoid this, unhook the connector registration functions.
381+ *
382+ * @since 7.0.0
383+ */
384+ function _unhook_connector_registration () {
385+ remove_action ( 'init ' , '_wp_register_default_connector_settings ' , 20 );
386+ remove_action ( 'init ' , '_wp_connectors_pass_default_keys_to_ai_client ' , 20 );
387+ }
388+ tests_add_filter ( 'init ' , '_unhook_connector_registration ' , 1000 );
389+
378390/**
379391 * Before the abilities API categories init action runs, unhook the core ability
380392 * categories registration function to prevent core categories from being registered
You can’t perform that action at this time.
0 commit comments