钩子文档

wp_filesize

💡 云策文档标注

概述

wp_filesize 是一个 WordPress 过滤器,用于修改文件大小值。它允许开发者在获取文件大小时应用自定义逻辑。

关键要点

  • 过滤器名称:wp_filesize
  • 参数:$size(PHP filesize 的结果,整数类型)和 $path(文件路径,字符串类型)
  • 返回值:整数类型,通过 apply_filters 应用过滤器
  • 相关函数:wp_filesize(),作为 PHP filesize 的包装器,包含过滤器和结果整数转换
  • 引入版本:WordPress 6.0.0

📄 原文内容

Filters the size of the file.

Parameters

$sizeint
The result of PHP filesize on the file.
$pathstring
Path to the file.

Source

return (int) apply_filters( 'wp_filesize', $size, $path );

Changelog

Version Description
6.0.0 Introduced.