[wp-trac] [WordPress Trac] #34723: Warning in get_the_terms() because of non-array
WordPress Trac
noreply at wordpress.org
Wed Dec 9 20:25:53 UTC 2015
#34723: Warning in get_the_terms() because of non-array
--------------------------------------+------------------------------
Reporter: mrppp | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.4
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Changes (by stephenharris):
* keywords: => has-patch has-unit-tests
* version: => 4.4
Comment:
I believe this is a bug in WordPress, specifically in `get_the_terms()`.
See this line:
https://github.com/WordPress/WordPress/blob/77e365efbf2e499e2ed11d29c101ea466cf1ceed
/wp-includes/category-template.php#L1158 and the `foreach` loop a few
lines above it - both assume that `$terms` is an array, but
`wp_get_object_terms()` will return a `WP_Error` when the taxonomy doesn't
exist.
In 4.3.1 `get_the_terms()` could be used with a non-registered taxonomy
without any issues (it would return a `WP_Error()`). Currently `array_map`
on `WP_Error` object would give the reported error.
Looks like this issues was introduced in [35032]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34723#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list