[wp-trac] [WordPress Trac] #42513: WP_Theme::get_post_templates() is extremely inefficient for large themes

WordPress Trac noreply at wordpress.org
Sat Nov 11 14:07:03 UTC 2017


#42513: WP_Theme::get_post_templates() is extremely inefficient for large themes
-----------------------------------------+-----------------------------
 Reporter:  gschoppe                     |      Owner:
     Type:  defect (bug)                 |     Status:  new
 Priority:  normal                       |  Milestone:  Awaiting Review
Component:  Themes                       |    Version:  4.8.3
 Severity:  normal                       |   Keywords:
  Focuses:  administration, performance  |
-----------------------------------------+-----------------------------
 WP_Theme::get_post_templates() uses file_get_contents() to read the
 complete contents of each theme php file in the root of a theme into
 memory, twice, and processes the result with a custom Regular Expression.

 As a result, significantly more data than necessary is processed when
 loading large themes.

 In addition, because the standard get_file_data() function is not called
 (as it is with all other header comments), the "extra_{$context}_headers"
 filter is never called, which is inconsistent behavior with other
 file_header related operations, such as the WP_Theme constructor.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42513>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list