#55162 closed defect (bug) (fixed)
Incorrect parameter passed to update_term_cache from _prime_term_caches
Reported by: | david.binda | Owned by: | peterwilsoncc |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
The update_term_cache
function has a deprecated parameter string $taxonomy
, which is not used. the _prime_term_caches
function
is calling the update_term_cache
while passing in it's own parameter $update_meta_cache
, which is of a boolean type, and has nothing to do with taxonomy.
As the update_term_cache
has deprecated the $taxonomy
parameter, there is no harm in passing in the bool value as second argument, but it makes the code less readable, as it's clearly wrong.
It seems like it has been that way since introduction in r37573
From my point of view, the _prime_term_caches
should be calling the update_term_cache
function with a single argument.
Attachments (1)
Change History (7)
#4
in reply to:
↑ 2
@
3 years ago
Replying to azouamauriac:
Also it seems like _prime_term_caches is the only function which uses update_term_cache with the second parameter, so I think we can remove safely its second parameter "$taxonomy" in
update_term_cache.
WordPress tends to keep the deprecated parameters listed to future proof against any upcoming changes:
fn( $string, $object, $array )
might have the final argument deprecated fn( $string, $object, $deprecated )
. The deprecated parameter needs to be keep as a placeholder in case a new parameter is added at a later date, eg fn( $string, $object, $deprecated, $boolean )
There's a little judgement involved each time.
However, it doesn't look like the $taxonomy
argument was formally deprecated in update_term_cache()
so perhaps you could look at that on another ticket.
Hello thanks for your report, after some deeply search the $taxonomy seems to become unused here [34999].
Also it seems like _prime_term_caches is the only function which uses update_term_cache with the second parameter, so I think we can remove safely its second parameter "$taxonomy" in
update_term_cache.
Thanks.