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
This commit is contained in:
parent
78ee7b26e5
commit
e5056e0ac6
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user