wp_get_connector()
Gets a registered connector by its identifier.
Call this function after the init action, for example on wp_loaded. If a connector may be missing, check it first with wp_is_connector_registered(). Requesting a missing connector triggers an _doing_it_wrong() notice.
No Hooks.
Returns
Array|null.
array- connector data:name,description,type, optionallogo_url,authentication, and optionalplugin.null- if the registry is not initialized or the connector is not registered.
Usage
wp_get_connector( $id ): ?array;
- $id(string) (required)
- Connector identifier, for example
anthropic.
Examples
#1 Data retrieval of the connector
if ( wp_is_connector_registered( 'anthropic' ) ) {
$connector = wp_get_connector( 'anthropic' );
echo esc_html( $connector['name'] );
}
Notes
Changelog
| Since 7.0.0 | Introduced. |
wp_get_connector() wp get connector code WP 7.0.4
function wp_get_connector( string $id ): ?array {
$registry = WP_Connector_Registry::get_instance();
if ( null === $registry ) {
return null;
}
return $registry->get_registered( $id );
}