[wp-trac] [WordPress Trac] #41518: The full-path body class is missing a hyphen.

WordPress Trac noreply at wordpress.org
Tue Aug 1 16:38:40 UTC 2017


#41518: The full-path body class is missing a hyphen.
-------------------------------+-----------------------------
 Reporter:  isaaclubow         |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:  template           |
-------------------------------+-----------------------------
 In a case where page templates (eg "full-width.php") are in a folder
 called "templates" - a body class is created called "page-template-
 templatesfull-width-php". This is because post-template.php line 611
 sanitizes the file path without replacing "/" with a hyphen like it does
 for template name parts on line 609.
 I suggest replacing 611 with

 {{{
 $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace(
 array( '.', '/' ), '-', $template_slug ) );
 }}}

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


More information about the wp-trac mailing list