钩子文档

file_is_displayable_image

💡 云策文档标注

概述

file_is_displayable_image 是一个 WordPress 过滤器,用于控制图像是否能在浏览器中显示。它允许开发者基于图像路径自定义验证逻辑。

关键要点

  • 过滤器名称:file_is_displayable_image
  • 参数:$result(布尔值,默认 true,表示图像可显示)和 $path(字符串,图像路径)
  • 用途:验证图像是否适合在网页中显示,常用于图像处理或安全过滤
  • 相关函数:file_is_displayable_image(),位于 wp-admin/includes/image.php
  • 引入版本:WordPress 2.5.0

📄 原文内容

Filters whether the current image is displayable in the browser.

Parameters

$resultbool
Whether the image can be displayed. Default true.
$pathstring
Path to the image.

Source

return apply_filters( 'file_is_displayable_image', $result, $path );

Changelog

Version Description
2.5.0 Introduced.