Make WordPress Core

Opened 5 years ago

Closed 5 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 Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version:
Severity: minor Keywords:
Cc: Focuses: performance

Description

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
5 years ago

  • Component GeneralPosts, Post Types
  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

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.