[wp-trac] [WordPress Trac] #54645: Allow numeric theme name

WordPress Trac noreply at wordpress.org
Sat May 28 14:58:50 UTC 2022


#54645: Allow numeric theme name
-------------------------------------+-------------------------------------
 Reporter:  alvastar                 |       Owner:  spacedmonkey
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  Future Release
Component:  REST API                 |     Version:  5.7
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch needs-       |     Focuses:  administration,
  testing                            |  template, multisite, rest-api
-------------------------------------+-------------------------------------
Changes (by lopo):

 * keywords:  needs-unit-tests has-patch => needs-patch needs-testing


Comment:

 To clarify: having a numerical name (in `style.css`) doesn't seem to
 create problems, while having a numerical ''folder name'' does.

 The patch fixes this by making sure that we cast the theme dirname to a
 string when creating the `WP_Theme` object.

 To test, rename e.g. `wp-content/themes/twentytwentyone` to `wp-
 content/themes/2021`.

 Without the patch:
 - setting the theme as "Active" doesn't result in being displayed as such
 in `Appearance` > `Themes`
 - editing a post in the block editor shows e.g. no section to set featured
 image in the sidebar

 With this patch:
 - setting the theme as "Active" results in being displayed as such in
 `Appearance` > `Themes`
 - editing a post in the block editor shows the supported features e.g. the
 featured image

 I'm removing the `needs-unit-tests` keyword since there's currently no
 default theme with a numerical dirname to be retrieved by a call to
 `wp_get_themes()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54645#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list