Core Function
View Source on Trac ↗ has_post_format()
has_post_format( mixed $format = array(), mixed $post = null ) Check if a post has any of the given formats, or any format.
Parameters 2 required
| Name / Type | Description |
|---|---|
| (string | | string[]) $format Optional. The format or formats to check. Default empty array. Required |
| (WP_Post | | int | null) $post Optional. The post to check. Defaults to the current post in the loop. Required |
Return Value
(bool)
bool True if the post has any of the given formats (or any format, if no format specified),
false otherwise.
Function Information
Since Version
3.1.0
Source File
wp-includes/post-formats.php
Advertisement