I’ve been trying to solve this but can’t seem to find anything on it.
When you “Download ZIP” from github, it doesn’t give you the “theme_name.zip” that you’d hope for, but rather “theme_name-master.zip“, which when average users install this the messed up folder name throws off child themes.
How can this be remedied, so that the zip download does not change anything?
For simplicity, You could host a script somewhere that downloads the script, renames the folder without the
-master
and then rezip’s the project, then send it to the user as a download.So something like (Requires PHP5 >= 5.2.0, cURL, ZipArchive, safe_mode & open_basedir off):
Fork it from GitHub ;p
That’s a bit problematic and I don’t think there’s a real fix, only workarounds. I faced the same problem with plugins and have only a partial solution: it works only on plugin/theme updates, not when installing.
Never tried, but maybe it’s possible to perform the folder rename on plugin (
register_activation_hook
) or theme (after_switch_theme
) activation.I’ve checked the core and the filter
upgrader_source_selection
works for themes and plugins. The repo slug is in GitHub’s URL:http://github.com/user/repo-name
.