From e5056e0ac6d7c3d6b5b99b97d0b494bd75955a28 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 13 Feb 2010 02:35:41 +0000 Subject: [PATCH] Fix notice in get_cat_name(). Return empty string if category does not exist, fixes #11737. git-svn-id: https://develop.svn.wordpress.org/trunk@13074 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/category.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/category.php b/wp-includes/category.php index 26c6a4281e..b2c05d273c 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -180,11 +180,13 @@ function get_cat_ID( $cat_name='General' ) { * @since 1.0.0 * * @param int $cat_id Category ID - * @return string Category name + * @return string Category name, or an empty string if category doesn't exist. */ function get_cat_name( $cat_id ) { $cat_id = (int) $cat_id; $category = &get_category( $cat_id ); + if ( ! $category || is_wp_error( $category ) ) + return ''; return $category->name; }