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

git-svn-id: https://develop.svn.wordpress.org/trunk@22412 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-11-06 23:47:14 +00:00
parent 49d5e725ce
commit ba7fb93e4e
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 );