WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#36932 closed defect (bug) (fixed)

`wp_get_object_terms()` checks wrong `$fields` values when priming termmeta cache

Reported by: dlh Owned by: boonebgorges
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.4
Component: Taxonomy Keywords:
Focuses: Cc:

Description

The $update_term_meta_cache argument to wp_get_object_terms() checks whether the $fields parameter is 'all_with_object_ids' or 'term_ids' before priming the termmeta cache. However, $fields accepts 'all_with_object_id' (singular) and 'ids'. The attached patch would update to the latter two strings.

Attachments (1)

36932.diff (1.4 KB) - added by dlh 4 years ago.

Download all attachments as: .zip

Change History (3)

@dlh
4 years ago

#1 @boonebgorges
4 years ago

  • Milestone changed from Awaiting Review to 4.6
  • Owner set to boonebgorges
  • Status changed from new to assigned

Wow, there are like three bugs in this four lines of code - one of which you didn't catch in your patch :) Thanks for the ticket.

#2 @boonebgorges
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 37567:

Fix termmeta pre-fetching in wp_get_object_terms().

[34529] introduced logic intended to prime the termmeta cache for certain
values of the fields parameter. There were a few bugs:

  • The all_with_object_id param was misspelled.
  • term_id was used instead of ids.
  • The values being passed to update_termmeta_cache() in the case where fields=ids was not correct.

All of these would result in a failure to pre-fetch termmeta in some cases.

Props dlh.
Fixes #36932.

Note: See TracTickets for help on using tickets.