wppaste
WordPress

apply_filters( 'rest_send_nocache_headers', bool $rest_send_nocache_headers )

Since
4.4.0, 6.3.2
Filters whether to send no-cache headers on a REST API request.

Compatibility

WordPress
since 6.3.2
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$rest_send_nocache_headersbool
Whether to send no-cache headers.

Where this hook fires · 1

  • wp-includes/rest-api/class-wp-rest-server.php:487WP_REST_Server::serve_request()

Source code

		 *		 * @since 4.4.0		 * @since 6.3.2 Moved the block to catch the filter added on rest_cookie_check_errors() from wp-includes/rest-api.php.		 *		 * @param bool $rest_send_nocache_headers Whether to send no-cache headers.		 */		$send_no_cache_headers = apply_filters( 'rest_send_nocache_headers', is_user_logged_in() ); 		/*		 * Send no-cache headers if $send_no_cache_headers is true,		 * OR if the HTTP_X_HTTP_METHOD_OVERRIDE is used but resulted a 4xx response code.		 */		if ( $send_no_cache_headers || ( true === $method_overridden && str_starts_with( $code, '4' ) ) ) {

Changelog

Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

6.3.2
Moved the block to catch the filter added on rest_cookie_check_errors() from wp-includes/rest-api.php.from the docblock
4.4.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.