[wp-trac] [WordPress Trac] #42517: get_file_data() doesn't support the single-line variant of post template headers

WordPress Trac noreply at wordpress.org
Sun Nov 12 13:05:46 UTC 2017


#42517: get_file_data() doesn't support the single-line variant of post template
headers
--------------------------+-----------------------------
 Reporter:  gschoppe      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 get_file_data() is the common function used to retrieve information stored
 in a file's header comment. The function works fine for Plugin files and
 Theme style.css files, but is currently not used by the functions
 enumerating post templates, despite their header format being a clear
 subset of the same grammar.

 The issue comes from the fact that post templates have traditionally
 supported single-line header comments, of the form:
 {{{#!php
 <?php // Template Name: Full-Width ?>
 }}}
 or even
 {{{#!php
 <? # Template Name: Full-Width ?>
 }}}

 Addressing this inconsistency will allow post templates to use the same
 file-handling function that other theme/plugin files use, and will
 significantly reducing the amount of potential data parsed by
 WP_Theme::get_post_templates() see issue
 [https://core.trac.wordpress.org/ticket/42513 #42513]

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


More information about the wp-trac mailing list