WordPress.org

Make WordPress Core

Ticket #16503: 16503.diff

File 16503.diff, 1.8 KB (added by nacin, 3 years ago)
  • wp-admin/includes/class-wp-posts-list-table.php

     
    476476                $title = _draft_or_post_title(); 
    477477                $post_type_object = get_post_type_object( $post->post_type ); 
    478478                $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); 
    479                 $post_format = get_post_format( $post->ID ); 
     479                $post_format = post_type_supports( $post->post_type, 'post-formats' ) && get_post_format( $post->ID ); 
    480480                $post_format_class = ( $post_format && !is_wp_error($post_format) ) ? 'format-' . sanitize_html_class( $post_format ) : 'format-default'; 
    481481        ?> 
    482482                <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status . ' ' . $post_format_class); ?> iedit' valign="top"> 
  • wp-admin/includes/template.php

     
    16471647                } 
    16481648        } 
    16491649 
    1650         if ( get_post_format( $post->ID ) ) 
     1650        if ( post_type_supports( $post->post_type, 'post-formats' ) && get_post_format( $post->ID ) ) 
    16511651                echo ' - <span class="post-state-format">' . get_post_format_string( get_post_format( $post->ID ) ) . '</span>'; 
    16521652} 
    16531653 
  • wp-includes/post.php

     
    487487function get_post_format( $post = null ) { 
    488488        $post = get_post($post); 
    489489 
     490        if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) 
     491                return false; 
     492 
    490493        $_format = get_the_terms( $post->ID, 'post_format' ); 
    491494 
    492495        if ( empty( $_format ) )