Ticket #17320: 17320.diff
File 17320.diff, 1.1 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
506 506 * @since 3.1.0 507 507 * @uses has_term() 508 508 * 509 * @param string $format The format to check for509 * @param string|array $format The format to check for 510 510 * @param object|id $post The post to check. If not supplied, defaults to the current post if used in the loop. 511 511 * @return bool True if the post has the format, false otherwise. 512 512 */ 513 513 function has_post_format( $format, $post = null ) { 514 return has_term('post-format-' . sanitize_key($format), 'post_format', $post); 514 if ( is_array( $format ) ) { 515 $format_prefixed = array(); 516 foreach ( $format as $f ) { 517 if ( !is_string( $f ) ) { 518 unset( $format_prefixed ); 519 unset( $f ); 520 return false; 521 } 522 $format_prefixed[] = 'post-format-' . sanitize_key( $f ); 523 } 524 unset( $format_prefixed ); 525 unset( $f ); 526 return has_term( $format_prefixed, 'post_format', $post ); 527 } 528 return has_term( 'post-format-' . sanitize_key( $format ), 'post_format', $post ); 515 529 } 516 530 517 531 /**