Title: WP_REST_Icons_Controller::get_items
Published: May 20, 2026

---

# WP_REST_Icons_Controller::get_items( WP_REST_Request $request ): 󠀁[WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)󠁿|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

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

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

Retrieves all icons.

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

 `$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)
required

Full details about the request.

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

 [WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)
|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) Response
object 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_icons_controller/get_items/?output_format=md#source)󠁿

    ```php
    public function get_items( $request ) {
    	$response = array();
    	$search   = $request->get_param( 'search' );
    	$icons    = WP_Icons_Registry::get_instance()->get_registered_icons( $search );
    	foreach ( $icons as $icon ) {
    		$prepared_icon = $this->prepare_item_for_response( $icon, $request );
    		$response[]    = $this->prepare_response_for_collection( $prepared_icon );
    	}
    	return rest_ensure_response( $response );
    }
    ```

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

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

| Uses | Description | 
| [WP_REST_Icons_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_icons_controller/prepare_item_for_response/)`wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php` |

Prepare a raw icon before it gets output in a REST API response.

  | 
| [WP_Icons_Registry::get_instance()](https://developer.wordpress.org/reference/classes/wp_icons_registry/get_instance/)`wp-includes/class-wp-icons-registry.php` |

Utility method to retrieve the main instance of the class.

  | 
| [rest_ensure_response()](https://developer.wordpress.org/reference/functions/rest_ensure_response/)`wp-includes/rest-api.php` |

Ensures a REST response is a response object (for consistency).

  |

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

## User Contributed Notes

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