WP_Connector_Registry::set_instancepublic staticWP 7.0.0

Sets the main instance of the registry class.

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

Method of the class: WP_Connector_Registry{}

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WP_Connector_Registry::set_instance( $registry ): void;
$registry(WP_Connector_Registry) (required)
The registry instance.

Notes

Changelog

Since 7.0.0 Introduced.

WP_Connector_Registry::set_instance() code WP 7.0

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;
}