Opened 5 weeks ago
Last modified 5 weeks ago
#63256 reviewing defect (bug)
Unnecessary array_map() call in get_terms() when object_ids is not set
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
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
Change History (2)
This ticket was mentioned in PR #8668 on WordPress/wordpress-develop by @dilipbheda.
5 weeks ago
#1
Note: See
TracTickets for help on using
tickets.
Makes sense, thanks.