[wp-trac] [WordPress Trac] #54222: Document that the `get_terms` filter can have null for `$taxonomies`
WordPress Trac
noreply at wordpress.org
Tue Oct 5 05:54:05 UTC 2021
#54222: Document that the `get_terms` filter can have null for `$taxonomies`
--------------------------+-----------------------------
Reporter: dd32 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: minor | Keywords:
Focuses: docs |
--------------------------+-----------------------------
The `get_terms` filter currently documents that the filter passes an array
as both the first and second parameters, which is normally true, except
that the second can be null when not specified.
The simplest way to trigger this scenario is to query for `get_terms( [
'term_taxonomy_id' => ?? ] );` which has no taxonomies to pass.
This can cause PHP Warnings and PHP Fatal errors in code that doesn't
expect it.
See some real world examples:
- https://github.com/WordPress/learn/pull/243
- https://github.com/Automattic/sensei/pull/4329
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54222>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list