get_post_gallery()
get_post_gallery( int|WP_Post $post, bool $html = true )
检查指定文章的库内容,如果存在,则返回第一个
Check a specified post’s content for gallery and, if present, return the first
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$post | (int | WP_Post) | 可选 | Post ID或WP_Post对象。默认值为全局$post。 |
$html | (bool) | 可选 | 是返回HTML还是返回数据。默认值为true。 |
返回(Return)
(string|数组)从展开的快捷方式中分析的库数据和src。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.6.0 | wp-includes/media.php:4227 | 1 function | 3 |
笔记(Notes)
如果页面中没有库,函数将返回false(布尔值)。
例子
get_post_gallery() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_post_gallery/