Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#54128 closed enhancement (duplicate)

Consider caching the outputs for label arrays in get_post_type_labels and get_taxonomy_labels

Reported by: kavelach's profile kavelach Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Posts, Post Types Keywords:
Focuses: performance Cc:


Currently, each time something calls get_post_type_labels or get_taxonomy_labels, those functions construct large arrays with default translations. When many post types or taxonomies are registered, these calls start to accumulate into something considerable.
This could be cached using a static variable, constructing them only once on each run of the script.

Change History (1)

#1 @SergeyBiryukov
2 years ago

  • Component changed from General to Posts, Post Types
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac!

Thanks for the ticket, we're already tracking this enhancement in #26746.

Note: See TracTickets for help on using tickets.