rest_api_allowed_post_types

BbPress & Jetpack REST API Compatibility Enables bbPress to work with the Jetpack REST API.

Description

apply_filters( 'rest_api_allowed_post_types', (array) $allowed_types ); 

Parameters (1)

0. $allowed_types (array)
Array of whitelisted post types. Default to array( post', page,, revision )'.

Usage

To run the hook, copy the example below.
  1. $allowed_types = apply_filters( 'rest_api_allowed_post_types', $allowed_types ); 
  2.  
  3. if ( !empty( $allowed_types ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the rest_api_allowed_post_types callback 
  2. function filter_rest_api_allowed_post_types( $allowed_types ) { 
  3. // make filter magic happen here... 
  4. return $allowed_types
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'rest_api_allowed_post_types', 'filter_rest_api_allowed_post_types', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'rest_api_allowed_post_types', 'filter_rest_api_allowed_post_types', 10, 1 ); 

Defined (1)

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

/class.json-api-endpoints.php  
  1. $allowed_types = apply_filters( 'rest_api_allowed_post_types', $allowed_types );