wp_is_jsonp_request()
Checks whether current request is a JSONP request, or is expecting a JSONP response.
1 time — 0.000001 sec (speed of light) | 50000 times — 0.01 sec (speed of light) | PHP 7.3.3, WP 5.2.3
Hooks from the function
Return
true|false
. True if JSONP request, false otherwise.
Usage
wp_is_jsonp_request();
Changelog
Since 5.2.0 | Introduced. |
Code of wp_is_jsonp_request() wp is jsonp request WP 5.9.3
function wp_is_jsonp_request() { if ( ! isset( $_GET['_jsonp'] ) ) { return false; } if ( ! function_exists( 'wp_check_jsonp_callback' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } $jsonp_callback = $_GET['_jsonp']; if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) { return false; } /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ $jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true ); return $jsonp_enabled; }