Make WordPress Core

Ticket #17320: 17320.1.diff

File 17320.1.diff, 1.0 KB (added by ericmann, 10 years ago)

Refreshed patch

  • wp-includes/post-formats.php

     
    3838 *
    3939 * @uses has_term()
    4040 *
    41  * @param string $format The format to check for.
    42  * @param object|int $post The post to check. If not supplied, defaults to the current post if used in the loop.
     41 * @param string|array $format The format to check for.
     42 * @param object|int   $post  The post to check. If not supplied, defaults to the current post if used in the loop.
    4343 * @return bool True if the post has the format, false otherwise.
    4444 */
    4545function has_post_format( $format, $post = null ) {
    46         return has_term('post-format-' . sanitize_key($format), 'post_format', $post);
     46        if ( ! is_array( $format ) ) {
     47                $format = array( $format );
     48        }
     49
     50        $prefixed = array();
     51        foreach( $format as $single ) {
     52                $prefixed[] = 'post-format-' . sanitize_key( $single );
     53        }
     54
     55        return has_term( $prefixed, 'post_format', $post );
    4756}
    4857
    4958/**