WP_REST_Block_Pattern_Categories_Controller::get_items( WP_REST_Request $request )

Retrieves all block pattern categories.


Parameters

$request

(WP_REST_Request) (Required) Full details about the request.


Top ↑

Return

(WP_Error|WP_REST_Response) Response object on success, or WP_Error object on failure.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php

	public function get_items( $request ) {
		$response   = array();
		$categories = WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered();
		foreach ( $categories as $category ) {
			$prepared_category = $this->prepare_item_for_response( $category, $request );
			$response[]        = $this->prepare_response_for_collection( $prepared_category );
		}

		return rest_ensure_response( $response );
	}


Top ↑

Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes

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