Title: WP_Connector_Registry::set_instance
Published: May 20, 2026

---

# WP_Connector_Registry::set_instance( WP_Connector_Registry $registry )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Sets the main instance of the registry class.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#description)󠁿

Called by `_wp_connectors_init()` during the `init` action. Must not be called outside
of that context.

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#see-also)󠁿

 * [_wp_connectors_init()](https://developer.wordpress.org/reference/functions/_wp_connectors_init/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#parameters)󠁿

 `$registry`[WP_Connector_Registry](https://developer.wordpress.org/reference/classes/wp_connector_registry/)
required

The registry instance.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#source)󠁿

    ```php
    public static function set_instance( WP_Connector_Registry $registry ): void {
    	if ( ! doing_action( 'init' ) ) {
    		_doing_it_wrong(
    			__METHOD__,
    			__( 'The connector registry instance must be set during the <code>init</code> action.' ),
    			'7.0.0'
    		);
    		return;
    	}

    	self::$instance = $registry;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-connector-registry.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-connector-registry.php#L419)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-connector-registry.php#L419-L430)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#related)󠁿

| Uses | Description | 
| [doing_action()](https://developer.wordpress.org/reference/functions/doing_action/)`wp-includes/plugin.php` |

Returns whether or not an action hook is currently being processed.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [_doing_it_wrong()](https://developer.wordpress.org/reference/functions/_doing_it_wrong/)`wp-includes/functions.php` |

Marks something as being incorrectly called.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#)

| Used by | Description | 
| [_wp_connectors_init()](https://developer.wordpress.org/reference/functions/_wp_connectors_init/)`wp-includes/connectors.php` |

Initializes the connector registry with default connectors and fires the registration action.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_connector_registry/set_instance/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_connector_registry%2Fset_instance%2F)
before being able to contribute a note or feedback.