has_post_format() – Check if a post has any of the given formats, or any format.
You appear to be a bot. Output may be restricted
Description
Check if a post has any of the given formats, or any format.
Usage
$bool = has_post_format( $format, $post );
Parameters
- $format
- ( string|string[] ) optional – Optional. The format or formats to check. Default empty array.
- $post
- ( WP_Post|int|null ) optional – Optional. The post to check. Defaults to the current post in the loop.
Returns
bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
Source
File name: wordpress/wp-includes/post-formats.php
Lines:
1 to 11 of 11
function has_post_format( $format = array(), $post = null ) { $prefixed = array(); if ( $format ) { foreach ( (array) $format as $single ) { $prefixed[] = 'post-format-' . sanitize_key( $single ); } } return has_term( $prefixed, 'post_format', $post ); }