Open mvl22 opened 4 months ago
Hi
Other workaround is to use --force
parameter - wp theme install https://public-api.wordpress.com/rest/v1/themes/download/rockfield.zip --activate --force
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.
I agree with this.
Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices.
I'm unable to replicate the issue. WP CLI definitely throws an error when it tries to activate the newly installed child theme with no parent theme available in WordPress install.
But once you install the parent theme, child theme can be successfully activated from the back-end or the shell, there is no need to install the child theme again.
wp theme install https://public-api.wordpress.com/rest/v1/themes/download/rockfield.zip --activate
Downloading installation package from https://public-api.wordpress.com/rest/v1/themes/download/rockfield.zip... Unpacking the package... Installing the theme... This theme requires a parent theme. Checking if it is installed... The parent theme could not be found. You will need to install the parent theme, varia-wpcom, before you can use this child theme. Theme installed successfully. Activating 'rockfield-wpcom'... Error: The parent theme is missing. Please install the "varia-wpcom" parent theme.
wp theme install https://public-api.wordpress.com/rest/v1/themes/download/varia.zip --activate
Downloading installation package from https://public-api.wordpress.com/rest/v1/themes/download/varia.zip... Unpacking the package... Installing the theme... Theme installed successfully. Activating 'varia-wpcom'... Success: Switched to 'Varia' theme. Success: Installed 1 of 1 themes.
wp theme activate rockfield-wpcom
Success: Switched to 'Rockfield' theme.
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:
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.