rest_api_init

The WordPress Core rest api init hook.

Description

add_action( 'rest_api_init', (callback) $array ); 

Parameters (1)

0. $array (callback) => array( 'Jetpack_Core_Json_Api_Endpoints', 'register_endpoints' )
The array.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'rest_api_init', $array ); 
The following example is for adding a hook callback.
  1. // define the rest_api_init callback 
  2. function action_rest_api_init( $array ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'rest_api_init', 'action_rest_api_init', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'rest_api_init', 'action_rest_api_init', 10, 1 ); 

Defined (3)

The action is defined in the following location(s).

/_inc/lib/class.core-rest-api-endpoints.php  
  1. add_action( 'rest_api_init', array( 'Jetpack_Core_Json_Api_Endpoints', 'register_endpoints' ) ); 
/modules/contact-form/grunion-contact-form.php  
  1. add_action( 'rest_api_init', 'grunion_contact_form_require_endpoint' ); 
/modules/related-posts/jetpack-related-posts.php  
  1. add_action( 'rest_api_init', array( $this, 'rest_register_related_posts' ) );