Filter
rpress_handle_service_cookie
On this page
Filters the list of enabled service types used to validate the service_type cookie.
Runs on init inside RestroPress::rpress_handle_service_cookie, unless the old UI/UX option is enabled. The list comes from rpress_get_enabled_services(). The cookie value is checked against this list, and if it is missing or not in the list, the cookie is reset to the default service. Use the filter to add or remove service slugs for the purpose of cookie validation.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$services | array | Array of enabled service slugs, for example array( 'delivery', 'pickup' ). |
Return value#
array. The array of valid service slugs.
Example#
function my_limit_cookie_services( $services ) {
return array_values( array_diff( $services, array( 'delivery' ) ) );
}
add_filter( 'rpress_handle_service_cookie', 'my_limit_cookie_services' );
Notes#
Only affects cookie validation and default selection. Use rpress_enable_services to change which services are enabled everywhere.
Source#
Applied in:
includes/class-rpress.php(line 385), inRestroPress::rpress_handle_service_cookie()
See also#
Was this page helpful?
