wp_opcache_invalidate_file
云策文档标注
概述
wp_opcache_invalidate_file 是一个 WordPress 过滤器,用于控制是否从操作码缓存中使单个 PHP 文件失效。它允许开发者自定义文件失效行为。
关键要点
- 过滤器名称:wp_opcache_invalidate_file
- 参数:$will_invalidate(布尔值,默认 true,表示 WordPress 是否会使文件失效)和 $filepath(字符串,要失效的 PHP 文件路径)
- 用途:在 wp_opcache_invalidate() 函数中调用,用于清理单个 PHP 文件的操作码缓存
- 引入版本:WordPress 5.5.0
原文内容
Filters whether to invalidate a file from the opcode cache.
Parameters
$will_invalidatebool-
Whether WordPress will invalidate
$filepath. Default true. $filepathstring-
The path to the PHP file to invalidate.
Source
if ( apply_filters( 'wp_opcache_invalidate_file', true, $filepath ) ) {
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |