函数原型
has_post_format( string|string[] $format = array(), WP_Post|int|null $post = null ): bool
函数描述
Check if a post has any of the given formats, or any format.
是否弃用
未弃用
函数参数
-
$format
string|string[]
Optional - The format or formats to check.
Default:
array() -
$post
WP_Post|int|null
Optional - The post to check. Defaults to the current post in the loop.
Default:
null
函数返回值
bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
函数位置
File: wp-includes/post-formats.php.
函数源码
$format = has_post_format($format, $post_id);源码链接
变更日志
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |

