From 09820497cb0ca794c210ba9f8e1dd41ac8850d5c Mon Sep 17 00:00:00 2001 From: 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: http://svn.automattic.com/wordpress/trunk@13074 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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; }