[wp-trac] [WordPress Trac] #21155: Prevent warnings in get_the_category from unregistered "category" taxonomy
WordPress Trac
wp-trac at lists.automattic.com
Wed Jul 4 14:29:03 UTC 2012
#21155: Prevent warnings in get_the_category from unregistered "category" taxonomy
--------------------------+-----------------------------
Reporter: batmoo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.4
Severity: normal | Keywords:
--------------------------+-----------------------------
{{{get_the_terms}}} can return a WP_Error object if the category taxonomy
is not defined (something that sites can do if they want custom
taxonomies). This results in some warnings from {{{get_the_category}}}
because it assumes that the category taxonomy will always be there and it
will always get a valid value back.
{{{
Warning: array_values() expects parameter 1 to be array, object given in
/home/wpcom/public_html/wp-includes/category-template.php on line 79
Warning: array_keys() expects parameter 1 to be array, null given in
/home/wpcom/public_html/wp-includes/category-template.php on line 81
Warning: Invalid argument supplied for foreach() in
/home/wpcom/public_html/wp-includes/category-template.php on line 81
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21155>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list