Make WordPress Core

Opened 17 months ago

Closed 14 months ago

Last modified 12 months ago

#57701 closed defect (bug) (fixed)

Do not prime term meta in `wp_get_object_terms`

Reported by: spacedmonkey's profile spacedmonkey Owned by: spacedmonkey's profile spacedmonkey
Milestone: 6.3 Priority: normal
Severity: normal Version: 6.2
Component: Taxonomy Keywords: good-first-bug has-patch
Focuses: performance Cc:


Discoveried while working on [55252].

In [38667] in wp_get_object_terms use get_terms / WP_Term_Query. By default, this also prime term meta. But in most case, term meta will not be needed. It should not be primed by default.

See screenshot for example.

Attachments (1)

Screenshot 2023-02-13 at 00.12.05.png (118.0 KB) - added by spacedmonkey 17 months ago.

Download all attachments as: .zip

Change History (10)

#2 @spacedmonkey
17 months ago

  • Keywords needs-patch good-first-bug added

#3 @spacedmonkey
17 months ago

  • Milestone changed from Awaiting Review to 6.3

This ticket was mentioned in PR #4263 on WordPress/wordpress-develop by rutviksavsani.

16 months ago

  • Keywords has-patch added; needs-patch removed

Trac ticket:

#5 @spacedmonkey
15 months ago

@rutviksavsani Can you look at your PR again. After a rebase it seems have unit tests failing.

#6 @rutviksavsani
15 months ago

@spacedmonkey Thanks for pointing that out, I did fix the tests. It can be taken a look at now.

#7 @spacedmonkey
14 months ago

  • Owner set to spacedmonkey
  • Resolution set to fixed
  • Status changed from new to closed

In 55759:

Taxonomy: Do not prime term meta in wp_get_object_terms.

Passing update_term_meta_cache argument value false by default resulting in get_terms to not prime the term meta cache in wp_get_object_terms. Priming of term meta is not needed in this context.

Props spacedmonkey, rutviksavsani.
Fixes #57701.

Note: See TracTickets for help on using tickets.