wppaste
WordPress

WP_REST_Abilities_V1_List_Controller

Since
6.9.0
Source
wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php:19
Core controller used to access abilities via the REST API.

Compatibility

WordPress
since 6.9.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in 3 of the 5 tracked releases, added in 6.9.0.

Hooks and filters fired · 1

Every hook that fires from inside WP_REST_Abilities_V1_List_Controller, in the order it appears in the class, grouped by the method that fires it.

Properties · 2

$namespacestringprotected
REST API namespace.
$rest_basestringprotected
REST API base route.

Methods · 8

Source code

class WP_REST_Abilities_V1_List_Controller extends WP_REST_Controller { 	/**	 * REST API namespace.	 *	 * @since 6.9.0	 * @var string	 */	protected $namespace = 'wp-abilities/v1'; 	/**	 * REST API base route.	 *	 * @since 6.9.0	 * @var string	 */	protected $rest_base = 'abilities'; 	/**	 * Registers the routes for abilities.	 *	 * @since 6.9.0	 *	 * @see register_rest_route()	 */	public function register_routes(): void {		register_rest_route(			$this->namespace,			'/' . $this->rest_base,			array(				array(					'methods'             => WP_REST_Server::READABLE,					'callback'            => array( $this, 'get_items' ),					'permission_callback' => array( $this, 'get_items_permissions_check' ),					'args'                => $this->get_collection_params(),				),				'schema' => array( $this, 'get_public_item_schema' ),			)		); 		register_rest_route(			$this->namespace,			'/' . $this->rest_base . '/(?P<name>[a-zA-Z0-9\-\/]+)',			array(				'args'   => array(					'name' => array(						'description' => __( 'Unique identifier for the ability.' ),						'type'        => 'string',						'pattern'     => '^[a-zA-Z0-9\-\/]+$',					),				),				array(					'methods'             => WP_REST_Server::READABLE,					'callback'            => array( $this, 'get_item' ),					'permission_callback' => array( $this, 'get_item_permissions_check' ),				),				'schema' => array( $this, 'get_public_item_schema' ),			)		);	} 	/**	 * Retrieves all abilities.	 *	 * @since 6.9.0	 *	 * @param WP_REST_Request $request Full details about the request.	 * @return WP_REST_Response Response object on success.	 */	public function get_items( $request ) {		$query_args = array(			'meta' => array( 'show_in_rest' => true ),		); 		if ( ! empty( $request['category'] ) ) {			$query_args['category'] = $request['category'];		} 		if ( ! empty( $request['namespace'] ) ) {			$query_args['namespace'] = $request['namespace'];

Changelog

Introduced in 6.9.0. 3 changes between 6.9.7 and 7.1.0.

  1. 6.9.7
  2. 7.0.4
  3. 7.1.0

Signature, return type and hooks compared across 3 parsed releases.

7.1.0
Method normalize_schema_empty_object_defaults() removed.verified against source
7.1.0
Method strip_internal_schema_keywords() removed.verified against source
7.0.4
Method strip_internal_schema_keywords() added.verified against source
6.9.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.