wp_allow_query_attachment_by_filename
云策文档标注
概述
本文档介绍 WordPress 中的 wp_allow_query_attachment_by_filename 过滤器,用于控制附件查询是否包含文件名。此过滤器在 WP_Query::get_posts() 中应用,影响附件查询行为。
关键要点
- wp_allow_query_attachment_by_filename 是一个布尔型过滤器,决定附件查询是否包含文件名。
- 默认值为 false,表示不包含文件名;可通过 apply_filters 修改此值。
- 此过滤器在 WordPress 6.0.3 版本中引入,用于增强附件查询的灵活性。
- 相关函数包括 WP_Query::get_posts(),位于 wp-includes/class-wp-query.php 文件中。
原文内容
Filters whether an attachment query should include filenames or not.
Parameters
$allow_query_attachment_by_filenamebool-
Whether or not to include filenames.
Source
$this->allow_query_attachment_by_filename = apply_filters( 'wp_allow_query_attachment_by_filename', false );
Changelog
| Version | Description |
|---|---|
| 6.0.3 | Introduced. |