| 1 | Index: wp-includes/post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/post.php (revision 17848) |
|---|
| 4 | +++ wp-includes/post.php (working copy) |
|---|
| 5 | @@ -506,12 +506,26 @@ |
|---|
| 6 | * @since 3.1.0 |
|---|
| 7 | * @uses has_term() |
|---|
| 8 | * |
|---|
| 9 | - * @param string $format The format to check for |
|---|
| 10 | + * @param string|array $format The format to check for |
|---|
| 11 | * @param object|id $post The post to check. If not supplied, defaults to the current post if used in the loop. |
|---|
| 12 | * @return bool True if the post has the format, false otherwise. |
|---|
| 13 | */ |
|---|
| 14 | function has_post_format( $format, $post = null ) { |
|---|
| 15 | - return has_term('post-format-' . sanitize_key($format), 'post_format', $post); |
|---|
| 16 | + if ( is_array( $format ) ) { |
|---|
| 17 | + $format_prefixed = array(); |
|---|
| 18 | + foreach ( $format as $f ) { |
|---|
| 19 | + if ( !is_string( $f ) ) { |
|---|
| 20 | + unset( $format_prefixed ); |
|---|
| 21 | + unset( $f ); |
|---|
| 22 | + return false; |
|---|
| 23 | + } |
|---|
| 24 | + $format_prefixed[] = 'post-format-' . sanitize_key( $f ); |
|---|
| 25 | + } |
|---|
| 26 | + unset( $format_prefixed ); |
|---|
| 27 | + unset( $f ); |
|---|
| 28 | + return has_term( $format_prefixed, 'post_format', $post ); |
|---|
| 29 | + } |
|---|
| 30 | + return has_term( 'post-format-' . sanitize_key( $format ), 'post_format', $post ); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | /** |
|---|