rest_endpoints filter-hookWP 4.4.0

Filters the array of available REST API endpoints.

Usage

add_filter( 'rest_endpoints', 'wp_kama_rest_endpoints_filter' );

/**
 * Function for `rest_endpoints` filter-hook.
 * 
 * @param array $endpoints The available endpoints. An array of matching regex patterns, each mapped to an array of callbacks for the endpoint. These take the format `'/path/regex' => array( $callback, $bitmask )` or `'/path/regex' => array( array( $callback, $bitmask ).
 *
 * @return array
 */
function wp_kama_rest_endpoints_filter( $endpoints ){

	// filter...
	return $endpoints;
}
$endpoints(array)
The available endpoints. An array of matching regex patterns, each mapped to an array of callbacks for the endpoint. These take the format '/path/regex' => array( $callback, $bitmask ) or `'/path/regex' => array( array( $callback, $bitmask ).

Changelog

Since 4.4.0 Introduced.

Where the hook is called

WP_REST_Server::get_routes()
rest_endpoints
wp-includes/rest-api/class-wp-rest-server.php 852
$endpoints = apply_filters( 'rest_endpoints', $endpoints );

Where the hook is used in WordPress

Usage not found.