WordPress.org

Make WordPress Core

Changeset 13074


Ignore:
Timestamp:
02/13/2010 02:35:41 AM (10 years ago)
Author:
nacin
Message:

Fix notice in get_cat_name(). Return empty string if category does not exist, fixes #11737.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category.php

    r12694 r13074  
    181181 *
    182182 * @param int $cat_id Category ID
    183  * @return string Category name
     183 * @return string Category name, or an empty string if category doesn't exist.
    184184 */
    185185function get_cat_name( $cat_id ) {
    186186    $cat_id = (int) $cat_id;
    187187    $category = &get_category( $cat_id );
     188    if ( ! $category || is_wp_error( $category ) )
     189        return '';
    188190    return $category->name;
    189191}
Note: See TracChangeset for help on using the changeset viewer.