Filter hook 'rest_endpoints'

in WP Core File wp-includes/rest-api/class-wp-rest-server.php at line 973

View Source

rest_endpoints

Filter Hook
Description
Filters the array of available REST API endpoints.

Hook Information

File Location wp-includes/rest-api/class-wp-rest-server.php View on GitHub
Hook Type Filter
Line Number 973

Hook Parameters

Type Name Description
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 ).

Usage Examples

Basic Usage
<?php
// Hook into rest_endpoints
add_filter('rest_endpoints', 'my_custom_filter', 10, 1);

function my_custom_filter($endpoints) {
    // Your custom filtering logic here
    return $endpoints;
}

Source Code Context

wp-includes/rest-api/class-wp-rest-server.php:973 - How this hook is used in WordPress core
<?php
 968  		 * @param array $endpoints The available endpoints. An array of matching regex patterns, each mapped
 969  		 *                         to an array of callbacks for the endpoint. These take the format
 970  		 *                         `'/path/regex' => array( $callback, $bitmask )` or
 971  		 *                         `'/path/regex' => array( array( $callback, $bitmask ).
 972  		 */
 973  		$endpoints = apply_filters( 'rest_endpoints', $endpoints );
 974  
 975  		// Normalize the endpoints.
 976  		$defaults = array(
 977  			'methods'       => '',
 978  			'accept_json'   => false,

PHP Documentation

<?php
/**
		 * Filters the array of available REST API endpoints.
		 *
		 * @since 4.4.0
		 *
		 * @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 ).
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/rest-api/class-wp-rest-server.php
Related Hooks

Related hooks will be displayed here in future updates.