Make WordPress Core

Ticket #15322: 15322.patch

File 15322.patch, 1.1 KB (added by mfields, 13 years ago)
  • post-template.php

     
    344344        $classes[] = 'hentry';
    345345
    346346        // Categories
    347         foreach ( (array) get_the_category($post->ID) as $cat ) {
    348                 if ( empty($cat->slug ) )
    349                         continue;
    350                 $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
     347        if( is_object_in_taxonomy( $post->post_type, 'category' ) ) {
     348                foreach ( (array) get_the_category($post->ID) as $cat ) {
     349                        if ( empty($cat->slug ) )
     350                                continue;
     351                        $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
     352                }
    351353        }
    352354
    353355        // Tags
    354         foreach ( (array) get_the_tags($post->ID) as $tag ) {
    355                 if ( empty($tag->slug ) )
    356                         continue;
    357                 $classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
     356        if( is_object_in_taxonomy( $post->post_type, 'post_tag' ) ) {
     357                foreach ( (array) get_the_tags($post->ID) as $tag ) {
     358                        if ( empty($tag->slug ) )
     359                                continue;
     360                        $classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
     361                }
    358362        }
    359363
    360364        if ( !empty($class) ) {