WordPress.org

Make WordPress Core

Ticket #15407: 15407.fix-for-no-category-posts-fatal-error.patch

File 15407.fix-for-no-category-posts-fatal-error.patch, 639 bytes (added by Viper007Bond, 11 years ago)
  • wp-includes/category-template.php

     
    6666function get_the_category( $id = false ) {
    6767        $categories = get_the_terms( $id, 'category' );
    6868
     69        if ( ! $categories )
     70                $categories = array();
     71
    6972        foreach ( array_keys( (array) $categories ) as $key ) {
    7073                _make_cat_compat( $categories[$key] );
    7174        }
     75
    7276        // Filter name is plural because we are return alot of categories not just one
    7377        return apply_filters( 'get_the_categories', $categories );
    7478}