[wp-trac] [WordPress Trac] #63256: Unnecessary array_map() call in get_terms() when object_ids is not set
WordPress Trac
noreply at wordpress.org
Wed Apr 9 11:10:53 UTC 2025
#63256: Unnecessary array_map() call in get_terms() when object_ids is not set
--------------------------+-----------------------------
Reporter: dilipbheda | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: normal | Keywords: has-patch
Focuses: |
--------------------------+-----------------------------
The `get_terms()` function always triggers the `else` block because the
result is cast to an array and sent to `array_map()`, even when
`object_ids` isn't set. This is unnecessary since the default value of
`object_ids` is `null`.
The default value here is `null`: https://github.com/WordPress/wordpress-
develop/blob/ac648a15245df2261c0782f7e1c618911f392601/src/wp-includes
/class-wp-term-query.php#L199C1-L199C4
The else block runs here: https://github.com/WordPress/wordpress-
develop/blob/ac648a15245df2261c0782f7e1c618911f392601/src/wp-includes
/class-wp-term-query.php#L596-L600
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63256>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list