钩子文档

wp_get_attachment_thumb_file

💡 云策文档标注

概述

本文档介绍了 wp_get_attachment_thumb_file 函数,该函数用于获取附件缩略图文件的路径,并在返回前应用过滤器。过滤器允许开发者修改缩略图文件路径。

关键要点

  • wp_get_attachment_thumb_file() 函数用于获取指定附件的缩略图文件路径。
  • 过滤器 'wp_get_attachment_thumb_file' 在函数返回路径前被应用,传递缩略图文件路径和附件 ID 作为参数。
  • 该函数位于 wp-includes/deprecated.php 文件中,自 WordPress 2.1.0 版本引入。

代码示例

return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );

📄 原文内容

Filters the attachment thumbnail file path.

Parameters

$thumbfilestring
File path to the attachment thumbnail.
$post_idint
Attachment ID.

More Information

The wp_get_attachment_thumb_file() function fetches the path to the thumbnail file of a given attachment. Just before the function returns the path, the filter is applied and the path to the file and attachment ID are passed as parameters.

Source

return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );

Changelog

Version Description
2.1.0 Introduced.