Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_jsonp_enabled

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
293           }
294
295           /**
296            * Filters whether JSONP is enabled for the REST API.
297            *
298            * @since 4.4.0
299            *
300            * @param bool $jsonp_enabled Whether JSONP is enabled. Default true.
301            */
302           $jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true );
303
304           $jsonp_callback = false;
305           if ( isset( $_GET['_jsonp'] ) ) {
306                $jsonp_callback = $_GET['_jsonp'];
307           }
308
309           $content_type = ( $jsonp_callback && $jsonp_enabled ) ? 'application/javascript' : 'application/json';
310           $this->send_header( 'Content-Type', $content_type . '; charset=' . get_option( 'blog_charset' ) );
311           $this->send_header( 'X-Robots-Tag', 'noindex' );