Open
Description
If you attempt to install a theme which is a subtheme, the install returns:
The parent theme could not be found. You will need to install the parent theme, <parent-theme-name>, before you can use this child theme.
However, it leaves behind a directory. After going to install the parent theme, re-running the command to install the subtheme then fails, with:
Destination folder already exists.
For instance:
# Attempt to install rockfield theme (not realising this is a subtheme)
wp theme install https://public-api.wordpress.com/rest/v1/themes/download/rockfield.zip --activate
# returns error "The parent theme could not be found. You will need to install the parent theme..."
# Attempt to install main theme
wp theme install https://public-api.wordpress.com/rest/v1/themes/download/varia.zip --activate
# returns success
# Now, go back to install the subtheme, rockfield:
wp theme install https://public-api.wordpress.com/rest/v1/themes/download/rockfield.zip --activate
# returns error "Destination folder already exists..."
# Workaround - firstly remove the left-behind folder, then retry the subtheme install:
rm -rf /path/to/wp-content/themes/rockfield-wpcom
wp theme install https://public-api.wordpress.com/rest/v1/themes/download/rockfield.zip --activate
If installation of a subtheme fails because the main theme is not there, the folder should not be left behind, i.e. it should be properly atomic.