Documentation

ServiceNoStore
in package

Add `no-store` cache control directive to WP REST API requests.

Tags
see
https://core.trac.wordpress.org/ticket/51831

Table of Contents

Constants

CACHE_CONTROL_HEADER  = 'Cache-Control'
CACHE_CONTROL_VALUE_NO_STORE  = 'no-cache, no-store, must-revalidate, max-age=0'
Add `no-store` to default content type.

Properties

$namespace  : mixed

Methods

getNamespace()  : mixed
Get namespace.
hook()  : mixed
Create and hook a `no-store` service for a given namespace starting with.
instance()  : ServiceNoStore
Get a new instance of ServiceNoStore.
rest_post_dispatch()  : mixed
Add `no-store` to nocache headers, but only once and only if not already modified through endpoint.
rest_send_nocache_headers()  : mixed
Check if a given REST API should send the nocache headers in general and add a filter to modify the header.
__construct()  : mixed
C'tor.

Constants

CACHE_CONTROL_HEADER

public mixed CACHE_CONTROL_HEADER = 'Cache-Control'

Properties

Methods

getNamespace()

Get namespace.

public getNamespace() : mixed
Tags
codeCoverageIgnore

hook()

Create and hook a `no-store` service for a given namespace starting with.

public static hook(string $namespace) : mixed
Parameters
$namespace : string

Must start with a leading slash!

instance()

Get a new instance of ServiceNoStore.

public static instance(string $namespace) : ServiceNoStore
Parameters
$namespace : string

Must start with a leading slash!

Tags
codeCoverageIgnore

Instance getter

Return values
ServiceNoStore

rest_post_dispatch()

Add `no-store` to nocache headers, but only once and only if not already modified through endpoint.

public rest_post_dispatch(WP_HTTP_Response $result, WP_REST_Server $server, WP_REST_Request $request) : mixed
Parameters
$result : WP_HTTP_Response

Result to send to the client. Usually a WP_REST_Response.

$server : WP_REST_Server

Server instance.

$request : WP_REST_Request

Request used to generate the response.

rest_send_nocache_headers()

Check if a given REST API should send the nocache headers in general and add a filter to modify the header.

public rest_send_nocache_headers(bool $rest_send_nocache_headers) : mixed
Parameters
$rest_send_nocache_headers : bool

Whether to send no-cache headers.

__construct()

C'tor.

private __construct(string $namespace) : mixed
Parameters
$namespace : string
Tags
codeCoverageIgnore

        
On this page

Search results