Install specific version of wp-cli package
I would like to install a specific version of a wp-cli package, e.g.
wp package install geekpress/[email protected]
or if this does not work, then from a specific github commit
wp package install [email protected]:GeekPress/wp-rocket-cli.git#04ff23bbc3e293d44e8dde4ae64e1918f3e8534a
But both does not work. Is there a way to fix the version? I'm using wp-cli in an automated environment, and I do not want it to break, if a wp-cli package changes a command in it`s latest commit.
As of WP-CLI version 2.5.0, the separator to be used between the package name and the desired version is a colon:
wp package install wp-cli-configmaps/wp-cli-configmaps:1.0.1
To verify it worked correctly, use the wp package list
command - you should see your specified version in the output:
+-------------------------------------+---------------------+---------+--------+----------------+
| name | authors | version | update | update_version |
+-------------------------------------+---------------------+---------+--------+----------------+
| wp-cli-configmaps/wp-cli-configmaps | Bostjan Skufca Jese | 1.0.1 | none | |
+-------------------------------------+---------------------+---------+--------+----------------+
The relevant WP-CLI source code is here. This probably works with pre-2.5.0 WP-CLI versions too.