Title: WP_REST_Icon_Collections_Controller::get_icon_collection
Published: August 20, 2026

---

# WP_REST_Icon_Collections_Controller::get_icon_collection( string $slug ): array|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_icon_collection/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_icon_collection/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_icon_collection/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_icon_collection/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_icon_collection/?output_format=md#changelog)

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

Retrieves a specific icon collection from the registry.

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

 `$slug`stringrequired

Icon collection slug.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_icon_collection/?output_format=md#return)󠁿

 array|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) Icon
collection data on success, or [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
object on failure.

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

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-icon-collections-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-icon-collections-controller.php#L163)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-icon-collections-controller.php#L163-L180)

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

| Uses | Description | 
| [WP_Icon_Collections_Registry::get_instance()](https://developer.wordpress.org/reference/classes/wp_icon_collections_registry/get_instance/)`wp-includes/class-wp-icon-collections-registry.php` |

Utility method to retrieve the main instance of the class.

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

Retrieves the translation of $text.

  | 
| [WP_Error::__construct()](https://developer.wordpress.org/reference/classes/wp_error/__construct/)`wp-includes/class-wp-error.php` |

Initializes the error.

  |

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

| Used by | Description | 
| [WP_REST_Icon_Collections_Controller::get_item()](https://developer.wordpress.org/reference/classes/wp_rest_icon_collections_controller/get_item/)`wp-includes/rest-api/endpoints/class-wp-rest-icon-collections-controller.php` |

Retrieves a specific icon collection.

  |

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

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

## User Contributed Notes

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