2

I would like to install a specific version of a wp-cli package, e.g.

wp package install geekpress/wp-rocket-cli@1.1

or if this does not work, then from a specific github commit

wp package install git@github.com: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.

user1383029
  • 1,685
  • 2
  • 19
  • 37

1 Answers1

1

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.

  • 1
    Thank you for this answer after 4 years! I'm not working with Wordpress anymore, but I hope this thread is helpful for somebody :) – user1383029 Jan 13 '22 at 17:10