[wp-trac] [WordPress Trac] #60055: Array to string conversion warning after r50157
WordPress Trac
noreply at wordpress.org
Tue Dec 12 21:59:15 UTC 2023
#60055: Array to string conversion warning after r50157
--------------------------+-----------------------------
Reporter: dcavins | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 6.4.2
Severity: minor | Keywords: has-patch
Focuses: |
--------------------------+-----------------------------
When using the new REST API feature that allows one to add the
`include_children` parameter to a taxonomy-term-filtered request, like
{{{
const query = {
categories: {
terms: [ 3, 5, 7 ],
include_children: true,
},
};
}}}
(example taken from https://make.wordpress.org/core/2021/02/23/rest-api-
changes-in-wordpress-5-7/)
I'm encountering the warning:
PHP Warning: Array to string conversion in /Users/cavinsd/Local
Sites/caresnet/app/public/wp-includes/class-wp.php on line 361
The error refers to this line:
{{{
$this->query_vars[ $t->query_var ] = str_replace( ' ', '+',
$this->query_vars[ $t->query_var ] );
}}}
which is expecting a flat taxonomy parameter, not a multidimensional
array.
Thanks for adding the `include_children` parameter; it makes working with
the REST API much simpler in some cases!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60055>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list