[wp-trac] [WordPress Trac] #64357: get_terms() no longer returns terms when "include" or "exclude" is set to 'all' or an empty value in WP 6.9
WordPress Trac
noreply at wordpress.org
Fri Dec 5 23:27:46 UTC 2025
#64357: get_terms() no longer returns terms when "include" or "exclude" is set to
'all' or an empty value in WP 6.9
--------------------------+------------------------------
Reporter: ibachal | Owner: johnjamesjacoby
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 6.9
Severity: major | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Changes (by johnjamesjacoby):
* owner: (none) => johnjamesjacoby
* status: new => assigned
Comment:
> Since updating to WordPress 6.9, the same code now returns no terms at
all.
@westonruter's comment
[https://core.trac.wordpress.org/ticket/64357#comment:1 here] correctly
identified the relevant (and intended) change in 6.9.
> When include = 'all' or an empty value, WordPress should treat it the
same as omitting the argument and return all terms.
Using `all` like this in the Comment/Post/User queries also returns none,
because `all` is not a known/handled/special value for the `include` or
`exclude` argument keys in any WordPress core Query class, and using it
like this ticket suggests never intentionally did anything unique.
For Terms, it was resulting in this kinda-weird code being run:
{{{
$include = wp_parse_id_list( array( 'all' ) );
}}}
...which would become...
{{{
$include = array( 0 );
}}}
...and this too is kinda weird again – and I propose is "invalid" – in the
sense that no Term/User/Post/Comment in the database could ever have an ID
of `0`, so including or excluding it doesn't (shouldn't) do anything.
----
As far as I can tell, and in my testing, the experience of passing a
literal empty `array()` value for either `include` or `exclude` appears to
be unchanged? `array()` is also the default value for both `include` and
`exclude` and the same `empty()` check happens in both 6.9 and 6.8
versions (and earlier).
----
> This breaks existing codebases and plugins that rely on passing 'all' or
empty values dynamically.
Agree that this change can appear to be somewhat breaking, but it is also
intentionally fixing an unbound database query bug, so I'm admittedly bias
towards not reverting without semi-significant breakage reported.
Let's dig into which plugins might be relying on that `all` method, see
what their plans are, and collaborate as needed here?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64357#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list