enclosure_links
云策文档标注
概述
enclosure_links 过滤器用于在查询数据库前修改附件链接列表,允许开发者添加或移除潜在的附件链接以保存到 postmeta 中。
关键要点
- 过滤器名称:enclosure_links
- 参数:$post_links(字符串数组,附件链接列表)和 $post_id(整数,文章 ID)
- 用途:在检查数据库现有附件前,调整附件链接列表
- 相关函数:do_enclose() 用于检查内容中的视频和音频链接并添加为附件
- 引入版本:WordPress 4.4.0
代码示例
$post_links = apply_filters( 'enclosure_links', $post_links, $post->ID );
原文内容
Filters the list of enclosure links before querying the database.
Description
Allows for the addition and/or removal of potential enclosures to save to postmeta before checking the database for existing enclosures.
Parameters
$post_linksstring[]-
An array of enclosure links.
$post_idint-
Post ID.
Source
$post_links = apply_filters( 'enclosure_links', $post_links, $post->ID );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |