Filter hook 'rest_jsonp_enabled'

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

View Source

rest_jsonp_enabled

Filter Hook
Description
Filters whether JSONP is enabled for the REST API.

Hook Information

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

Hook Parameters

Type Name Description
bool $jsonp_enabled Whether JSONP is enabled. Default true.

Usage Examples

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

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

Source Code Context

wp-includes/rest-api/class-wp-rest-server.php:310 - How this hook is used in WordPress core
<?php
 305  		 *
 306  		 * @since 4.4.0
 307  		 *
 308  		 * @param bool $jsonp_enabled Whether JSONP is enabled. Default true.
 309  		 */
 310  		$jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true );
 311  
 312  		$jsonp_callback = false;
 313  		if ( isset( $_GET['_jsonp'] ) ) {
 314  			$jsonp_callback = $_GET['_jsonp'];
 315  		}

PHP Documentation

<?php
/**
		 * Filters whether JSONP is enabled for the REST API.
		 *
		 * @since 4.4.0
		 *
		 * @param bool $jsonp_enabled Whether JSONP is enabled. Default true.
		 */
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.