wp_get_connectors()WP 7.0.0

Gets all registered connectors. Connector identifiers are used as array keys.

Call this function after the init action, for example on wp_loaded. Before the registry is initialized, it returns an empty array.

No Hooks.

Returns

Array.

  • array - connector data in the form identifier => data, with fields name, description, type, optional logo_url, authentication, and optional plugin.
  • [] - if the registry is not initialized or there are no connectors.

Usage

wp_get_connectors(): array;

Examples

0

#1 Getting the names of all connectors

$connector_names = wp_list_pluck( wp_get_connectors(), 'name' );

Notes

Changelog

Since 7.0.0 Introduced.

wp_get_connectors() code WP 7.0.4

function wp_get_connectors(): array {
	$registry = WP_Connector_Registry::get_instance();
	if ( null === $registry ) {
		return array();
	}

	return $registry->get_all_registered();
}