Make WordPress Core

Opened 2 years ago

Closed 21 months ago

Last modified 19 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:

Description

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 2 years ago.

Download all attachments as: .zip

Change History (10)

#2 @spacedmonkey
2 years ago

  • Keywords needs-patch good-first-bug added

#3 @spacedmonkey
2 years ago

  • Milestone changed from Awaiting Review to 6.3

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


23 months ago
#4

  • Keywords has-patch added; needs-patch removed

Trac ticket:

#5 @spacedmonkey
21 months ago

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

#6 @rutviksavsani
21 months ago

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

#7 @spacedmonkey
21 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.