From 55f599d330e81e7e2341f5635b3ce9b5adbded96 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 16 Nov 2010 00:19:51 +0000 Subject: [PATCH] Properly force variable to an array. props Viper007Bond, fixes #15407. git-svn-id: https://develop.svn.wordpress.org/trunk@16395 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/category-template.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 70a21a866b..9f15a87daa 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -65,8 +65,10 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename = */ function get_the_category( $id = false ) { $categories = get_the_terms( $id, 'category' ); + if ( ! $categories ) + $categories = array(); - foreach ( array_keys( (array) $categories ) as $key ) { + foreach ( array_keys( $categories ) as $key ) { _make_cat_compat( $categories[$key] ); } // Filter name is plural because we are return alot of categories not just one