WP_REST_Icon_Collections_Controller::get_icon_collection( string $slug ): array|WP_Error

In this article

Retrieves a specific icon collection from the registry.

Parameters

$slugstringrequired
Icon collection slug.

Return

array|WP_Error Icon collection data on success, or WP_Error object on failure.

Source

public function get_icon_collection( $slug ) {
	$registry   = WP_Icon_Collections_Registry::get_instance();
	$collection = $registry->get_registered( $slug );

	if ( null === $collection ) {
		return new WP_Error(
			'rest_icon_collection_not_found',
			sprintf(
				/* translators: %s: Icon collection slug. */
				__( 'Icon collection not found: "%s".' ),
				$slug
			),
			array( 'status' => 404 )
		);
	}

	return $collection;
}

Changelog

VersionDescription
7.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.