钩子文档

rest_url_details_cache_expiration

💡 云策文档标注

概述

rest_url_details_cache_expiration 是一个 WordPress 过滤器,用于调整 REST API 中 URL 详情数据缓存的过期时间。开发者可以通过此过滤器自定义缓存的有效期,以优化性能或适应特定需求。

关键要点

  • 这是一个过滤器,允许修改缓存过期时间(以秒为单位)。
  • 主要用于 WP_REST_URL_Details_Controller::set_cache() 函数中,控制 URL 详情数据的缓存管理。
  • 从 WordPress 5.9.0 版本开始引入。

代码示例

$cache_expiration = apply_filters( 'rest_url_details_cache_expiration', $ttl );

📄 原文内容

Filters the cache expiration.

Description

Can be used to adjust the time until expiration in seconds for the cache of the data retrieved for the given URL.

Parameters

$ttlint
The time until cache expiration in seconds.

Source

$cache_expiration = apply_filters( 'rest_url_details_cache_expiration', $ttl );

Changelog

Version Description
5.9.0 Introduced.