has_post_format

Definition:
function has_post_format( $format, $post = null ) {}

Check if a post has a particular format

Parameters

  • string $format: The format to check for
  • object|id $post: The post to check. If not supplied, defaults to the current post if used in the loop.

Return values

returns:True if the post has the format, false otherwise.

Source code

function has_post_format( $format, $post = null ) {

	return has_term('post-format-' . sanitize_key($format), 'post_format', $post);

}

9790

No comments yet... Be the first to leave a reply!

Leave a comment