Title: wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Developer.WordPress.org

---

# File: wp-includes/rest-api/endpoints/class-wp-rest-controller.php

 * method[WP_REST_Controller::get_fields_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_fields_for_response/)
 * Gets an array of fields to be included on the response.
 * Used by [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_fields_for_response/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_fields_for_response/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:572](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L572-L646)
 * method[WP_REST_Controller::get_object_type()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_object_type/)
 * Retrieves the object type this controller is responsible for managing.
 * Used by [3 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_object_type/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_object_type/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:552](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L552-L560)
 * method[WP_REST_Controller::get_endpoint_args_for_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_endpoint_args_for_item_schema/)
 * Retrieves an array of endpoint arguments from the item schema for the controller.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_endpoint_args_for_item_schema/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_endpoint_args_for_item_schema/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:658](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L658-L660)
 * method[WP_REST_Controller::sanitize_slug()](https://developer.wordpress.org/reference/classes/wp_rest_controller/sanitize_slug/)
 * Sanitizes the slug value.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/sanitize_slug/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/sanitize_slug/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:678](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L678-L680)
 * method[WP_REST_Controller::get_public_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_public_item_schema/)
 * Retrieves the item’s schema for display / public consumption purposes.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_public_item_schema/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_public_item_schema/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:321](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L321-L332)
 * method[WP_REST_Controller::get_collection_params()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_collection_params/)
 * Retrieves the query params for the collections.
 * Used by [11 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_collection_params/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_collection_params/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:341](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L341-L368)
 * method[WP_REST_Controller::get_context_param()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_context_param/)
 * Retrieves the magical context param.
 * Used by [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_context_param/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_context_param/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:380](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L380-L408)
 * method[WP_REST_Controller::add_additional_fields_to_object()](https://developer.wordpress.org/reference/classes/wp_rest_controller/add_additional_fields_to_object/)
 * Adds the values from additional fields to a data object.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/add_additional_fields_to_object/#used-by)
   | Uses [4 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/add_additional_fields_to_object/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:419](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L419-L444)
 * method[WP_REST_Controller::update_additional_fields_for_object()](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_additional_fields_for_object/)
 * Updates the values of additional fields added to a data object.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_additional_fields_for_object/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_additional_fields_for_object/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:455](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L455-L483)
 * method[WP_REST_Controller::add_additional_fields_schema()](https://developer.wordpress.org/reference/classes/wp_rest_controller/add_additional_fields_schema/)
 * Adds the schema from additional fields to a schema array.
 * Used by [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/add_additional_fields_schema/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/add_additional_fields_schema/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:495](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L495-L514)
 * method[WP_REST_Controller::get_additional_fields()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_additional_fields/)
 * Retrieves all of the registered additional fields for a given object-type.
 * Used by [4 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_additional_fields/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_additional_fields/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:527](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L527-L543)
 * method[WP_REST_Controller::delete_item()](https://developer.wordpress.org/reference/classes/wp_rest_controller/delete_item/)
 * Deletes one item from the collection.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/delete_item/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/delete_item/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:219](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L219-L226)
 * method[WP_REST_Controller::prepare_item_for_database()](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_item_for_database/)
 * Prepares one item for create or update operation.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_item_for_database/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_item_for_database/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:236](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L236-L243)
 * method[WP_REST_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_item_for_response/)
 * Prepares the item for the REST response.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_item_for_response/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_item_for_response/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:254](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L254-L261)
 * method[WP_REST_Controller::prepare_response_for_collection()](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_response_for_collection/)
 * Prepares a response for insertion into a collection.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_response_for_collection/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/prepare_response_for_collection/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:271](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L271-L285)
 * method[WP_REST_Controller::filter_response_by_context()](https://developer.wordpress.org/reference/classes/wp_rest_controller/filter_response_by_context/)
 * Filters a response based on the context defined in the schema.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/filter_response_by_context/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/filter_response_by_context/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:296](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L296-L301)
 * method[WP_REST_Controller::get_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item_schema/)
 * Retrieves the item’s schema, conforming to JSON Schema.
 * Used by [6 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item_schema/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item_schema/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:310](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L310-L312)
 * method[WP_REST_Controller::delete_item_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_controller/delete_item_permissions_check/)
 * Checks if a given request has access to delete a specific item.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/delete_item_permissions_check/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/delete_item_permissions_check/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:202](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L202-L209)
 * method[WP_REST_Controller::get_item()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item/)
 * Retrieves one item from the collection.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:117](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L117-L124)
 * method[WP_REST_Controller::create_item_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_controller/create_item_permissions_check/)
 * Checks if a given request has access to create items.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/create_item_permissions_check/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/create_item_permissions_check/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:134](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L134-L141)
 * method[WP_REST_Controller::create_item()](https://developer.wordpress.org/reference/classes/wp_rest_controller/create_item/)
 * Creates one item from the collection.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/create_item/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/create_item/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:151](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L151-L158)
 * method[WP_REST_Controller::update_item_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_item_permissions_check/)
 * Checks if a given request has access to update a specific item.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_item_permissions_check/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_item_permissions_check/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:168](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L168-L175)
 * method[WP_REST_Controller::update_item()](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_item/)
 * Updates one item from the collection.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_item/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/update_item/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:185](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L185-L192)
 * class[WP_REST_Controller](https://developer.wordpress.org/reference/classes/wp_rest_controller/)
 * Core base controller for managing and interacting with REST API items.
 * Used by [30 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:15](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L15-L681)
 * method[WP_REST_Controller::register_routes()](https://developer.wordpress.org/reference/classes/wp_rest_controller/register_routes/)
 * Registers the routes for the objects of the controller.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/register_routes/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/register_routes/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:49](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L49-L56)
 * method[WP_REST_Controller::get_items_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_items_permissions_check/)
 * Checks if a given request has access to get items.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_items_permissions_check/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_items_permissions_check/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:66](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L66-L73)
 * method[WP_REST_Controller::get_items()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_items/)
 * Retrieves a collection of items.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_items/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_items/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:83](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L83-L90)
 * method[WP_REST_Controller::get_item_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item_permissions_check/)
 * Checks if a given request has access to get a specific item.
 * Used by [0 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item_permissions_check/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/classes/wp_rest_controller/get_item_permissions_check/#uses)
   | Source: [wp-includes/rest-api/endpoints/class-wp-rest-controller.php:100](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php#L100-L107)