Update get_theme_slug
to allow theme names with hyphens/spaces
#228
Labels
enhancement
New feature or request
get_theme_slug
to allow theme names with hyphens/spaces
#228
Any theme name that includes a space needs to either have the space removed or replaced with a hyphen for use in the directory name and the text domain.
Currently, the
get_theme_slug
function is removing hyphens from a new theme name based on the following logic:When the source theme has a single-word slug but the new theme has a multi-word slug (e.g. cloning twentytwentythree and then naming the new theme tt3-clone would change the new theme name to 'tt3clone').
This can be confusing, as the .zip file has a different name to the chosen theme name, and it results in some discrepancies throughout the theme code where the slug is referenced, such as in pattern blocks and the Text Domain.
I believe this was to prevent hyphens from being used in theme support functions (e.g.
tt3-clone_support()
), but perhaps this logic could be more specific to the function name creation, rather than the theme slug itself. Could we replace the hyphens with underscores just for function names?This issue came up while testing #213.
The text was updated successfully, but these errors were encountered: