Make WordPress Core

Ticket #25429: 25429.4.diff

File 25429.4.diff, 1.9 KB (added by SergeyBiryukov, 13 years ago)
  • src/wp-includes/category-template.php

     
    136136function get_the_category_by_ID( $cat_ID ) {
    137137        $cat_ID = (int) $cat_ID;
    138138        $category = get_term( $cat_ID, 'category' );
     139
    139140        if ( is_wp_error( $category ) )
    140141                return $category;
    141         return $category->name;
     142
     143        return ( $category ) ? $category->name : '';
    142144}
    143145
    144146/**
  • src/wp-includes/category.php

     
    7676 * @param int|object $category Category ID or Category row object
    7777 * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
    7878 * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
    79  * @return mixed Category data in type defined by $output parameter.
     79 * @return object|array|WP_Error|null Category data in type defined by $output parameter. WP_Error if $category is empty, null if it does not exist.
    8080 */
    8181function get_category( $category, $output = OBJECT, $filter = 'raw' ) {
    8282        $category = get_term( $category, 'category', $output, $filter );
     83
    8384        if ( is_wp_error( $category ) )
    8485                return $category;
    8586
     
    284285 * @param int|object $tag
    285286 * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
    286287 * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
    287  * @return object|array Return type based on $output value.
     288 * @return object|array|WP_Error|null Tag data in type defined by $output parameter. WP_Error if $tag is empty, null if it does not exist.
    288289 */
    289290function get_tag( $tag, $output = OBJECT, $filter = 'raw' ) {
    290291        return get_term( $tag, 'post_tag', $output, $filter );