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:
parent
c09c079a6f
commit
3a8a6471e3
|
@ -73,7 +73,7 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
|
||||||
*/
|
*/
|
||||||
function get_the_category( $id = false ) {
|
function get_the_category( $id = false ) {
|
||||||
$categories = get_the_terms( $id, 'category' );
|
$categories = get_the_terms( $id, 'category' );
|
||||||
if ( ! $categories )
|
if ( ! $categories || is_wp_error( $categories ) )
|
||||||
$categories = array();
|
$categories = array();
|
||||||
|
|
||||||
$categories = array_values( $categories );
|
$categories = array_values( $categories );
|
||||||
|
|
Loading…
Reference in New Issue