Make WordPress Core

Opened 17 months ago

Closed 14 months ago

Last modified 14 months ago

#57114 closed enhancement (fixed)

Add caching to is_block_theme

Reported by: spacedmonkey's profile spacedmonkey Owned by: spacedmonkey's profile spacedmonkey
Milestone: 6.2 Priority: normal
Severity: normal Version: 5.9
Component: Themes Keywords: has-patch has-unit-tests add-to-field-guide
Focuses: performance Cc:


The function is_block_theme does a check on the filesystem if some times existing. This function could be called 100 of times per page request which would result in many many lookups. This value does not change, unless a theme is upgraded. Added a check would be simple and would save some CPU resources in looking up files.

Change History (12)

This ticket was mentioned in PR #3629 on WordPress/wordpress-develop by @spacedmonkey.

17 months ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.

15 months ago

#3 @mukesh27
15 months ago

  • Keywords changes-requested added

#4 @mukesh27
15 months ago

@spacedmonkey AS discuss in today's bug scrub. The PR needs some updated based on the feedback.

Ping @flixos90 for the review

Props to @costdev

Last edited 15 months ago by mukesh27 (previous) (diff)

@spacedmonkey commented on PR #3629:

15 months ago

@costdev Testing cache_get / cache_delete turned out harder than I thought. I have added some unit tests to this PR.

#6 @spacedmonkey
15 months ago

  • Owner set to spacedmonkey
  • Status changed from new to assigned

#7 @spacedmonkey
15 months ago

  • Keywords has-unit-tests added; changes-requested removed

Unit tests added. Reviews very welcome.

@spacedmonkey commented on PR #3629:

15 months ago

### Before

### After

@adamsilverstein commented on PR #3629:

15 months ago

Nice work @spacedmonkey - looks good to me.

#10 @flixos90
14 months ago

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

In 55236:

Themes: Add caching to WP_Theme::is_block_theme().

This changeset adds a block_theme entry in the theme cache data, similar to the existing entries headers, errors, stylesheet, and template.

Props spacedmonkey, costdev, joemcgill, flixos90, mukesh27, adamsilverstein.
Fixes #57114.

#12 @milana_cap
14 months ago

  • Keywords add-to-field-guide added
Note: See TracTickets for help on using tickets.