Check for WP_Error in get_the_category(). props batmoo. fixes #21155.

git-svn-id: http://core.svn.wordpress.org/trunk@22412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-06 23:47:14 +00:00
parent c09c079a6f
commit 3a8a6471e3
1 changed files with 1 additions and 1 deletions

View File

@ -73,7 +73,7 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
*/
function get_the_category( $id = false ) {
$categories = get_the_terms( $id, 'category' );
if ( ! $categories )
if ( ! $categories || is_wp_error( $categories ) )
$categories = array();
$categories = array_values( $categories );