Happy release day!

Today, I’m excited to bring you WP-CLI v0.25.0. Check out the newly published roadmap for details on upcoming releases and product focus (hint: there’s a future where WP-CLI no longer supports PHP 5.3).

Let’s dive in.

Compatibility with WordPress 4.7

WordPress 4.7 introduces a new WP_Hook implementation for registering and executing actions and filters. Because WP-CLI has its own WP_CLI::add_wp_hook() that was erroneously accessing the $wp_filter global even when the add_filter() function was available, WP-CLI could fatal in certain circumstances. WP-CLI now appropriately calls add_filter() when it’s available.

Importantly, due to the nature of these changes, WP-CLI versions prior to 0.25.0 will be incompatible with WordPress 4.7.

Inspect the change in this pull request.

New packages in the Package Index

The WP-CLI community has been quite active in creating new tools for you to use (and contribute back to):

Install any one of these with wp package install <package-name> (where <package-name> is typically the <user>/<repo>). When you do, go say thanks to the author!

More ways to install WP-CLI packages

Although we’d love to see your package listed in the Package Index, we realize there are reasons you might not be able to do so. wp package install now supports installing an arbitrary Git URL [#3482], .zip file [#3485], or directory path [#3484] as a package.

$ wp package install git@github.com:runcommand/doctor.git
$ wp package install https://github.com/runcommand/doctor.zip
$ wp package install doctor

(doctor is the second premium WP-CLI command from runcommand)

It’s worth noting Composer’s behavior is slightly different for each package type:

  • Git URLs are treated as VCS repositories, and cloned to ~/.wp-cli/packages/vendor.
  • ZIP archives (remote and local) are extracted to ~/.wp-cli/packages/local, and added as path repositories.
  • Local directory paths are added as path repositories, which means Composer creates a symlink to the existing directory path. If the directory you’ve provided is removed, then the installation will break.

Everything else in 0.25.0

New commands:

  • wp db check - Runs mysqlcheck with the default --check option [#3332].
  • wp site option * - CRUD commands for managing WordPress site options [#3386].
  • wp user session * - CRUD commands for managing user sessions [#3307].

Command improvements:

  • wp cli update:
    • Introduces --stable to install or reinstall the latest stable version [#3430].
  • wp core config:
    • Adds comments to generated wp-config.php to better match the one provided by WordPress core [#3312].
  • wp core download:
    • Preserves case for --version argument to properly handle release candidates [#3283].
    • Ensures wp core download --version=latest produces correctly-versioned cache key [#3467].
  • wp core language update:
    • Fixes strict standard error about variable reference [#3380].
    • Permits updating language packs even when en_US is set as locale [#3397].
  • wp core multisite-(install|convert):
    • Warns when multisite constants can’t be inserted into wp-config.php, instead of erroneously inserting at the end [#3272].
    • Includes adequate vertical spacing around inserted constants [#3267].
  • wp core update-db:
    • Ensures wp core update-db --network --dry-run is actually dry [#3347].
  • wp core version:
    • Displays default core language in wp core version --extra [#3221].
  • wp import:
    • Indicates current file in WXR import progress indicator to communicate the total count is of the current file, not all files [#3270].
  • wp media regenerate:
    • Adds a simple progress indicator [#3407].
  • wp option list:
    • Adds --no-transients flag to ignore transients [#3452].
    • Adds --exclude=<exclude> argument to list options excluding a specific pattern [#3455].
  • wp package install
    • Displays package dependency details when installing a package with a dependency [#3418, #3425].
  • wp package uninstall
    • Removes a package’s dependencies when the package is removed [#3343].
    • Properly assigns $composer_backup when uninstalling [#3399].
  • wp plugin install:
    • Removes branch names from directories created for Github-based ZIPs [#3314, #3451].
  • wp scaffold plugin-tests:
    • Uses PHP version specific to Trusty on CircleCI [#3359].
    • Uses correct default user for MySQL on CircleCI [#3457].
    • Uses the latest version of PHPUnit on Travis, depending on PHP version [#3463].
    • Adds WordPress Coding Standards to newly-scaffolded plugins [#3472].
  • wp search-replace:
    • Ensures tables are quoted to support all permitted characters [#3318].
    • Prevents error notice when export_insert_size isn’t defined [#3357].
    • Fails back to PHP if SQL triggers an error for some reason [#3387].
  • wp server:
    • Supports passing a custom .ini file to configure the server [#3330].
  • wp site create:
    • Use get_blog_details() for the site URL when creating a new site to ensure the correct URL is displayed [#3416].
  • wp site empty:
    • Ensures the entire uploads directory is empty [#3400].
  • wp theme install:
    • Correctly installs parent theme when installing a child theme [#3301].
  • wp transient:
    • Consolidates wp transient delete-all and wp transient delete-expired to flags of wp transient delete [#3389].
  • wp user create:
    • Prevents email notifications when users are created because email notifications should only be sent when --send-email is provided [#3331].

Framework enhancements:

  • Updates Composer-based dependencies to latest [#3257, #3429, #3460, #3468].
  • Properly handles registering an instantiated object as a command [#3269].
  • Splits the ProcessRun class out to its own file [#3377, #3422].
  • Permits running test suite with WP_VERSION env variable [#3383, #3392].
  • Prevents error notice when using Utils\get_named_sem_ver() with WP versions [#3404].
  • Fixes fatal error for failed early database connection by handling dead_db() error on nocache_headers filter [#3440].
  • Assigns a default $_SERVER['SERVER_NAME'] to prevent uncaught exception when wp_mail() is used [#3449].
  • Ignores url: in wp-cli.yml when alias is used, because aliases completely override user, url, path, ssh, and http [#3450].
  • Warns when WP_CLI::launch() ends up with return_code=-1, which could be caused by a custom compiled version of PHP that uses the --enable-sigchild option [#3458].
  • Provides more verbosity in wp_die() handler to give the end user more detail when a database connection fails [#3459].
  • Supports passing arguments to WP_CLI::do_hook() [#3470].
  • Logs the current alias when executing an alias group [#3471].
  • Only checks options for a positional argument when a value is present [#3481].
  • Variety of bash completion improvements [#3490, #3491, #3492].

Bug fixes across the board:

  • Defines all requisite dependencies for PHP 7 on Debian-based systems [#3208].
  • Ensures site --site_id= -> site --network_id= backwards compat shim only affects wp site create [#3227].
  • Catches exceptions thrown by RecursiveDirectoryIterator when verifying core checksums [#3266].
  • Passes slashed data in meta commands [#3274].
  • Ensures appropriate WP-CLI package index URL is used in the composer.json [#3276].
  • Corrects reference of WP_CLI to use global namespace in WP_CLI\Utils\get_temp_dir() [#3369].

Contributors to this release (pull requests, documentation, and package authors): 2ndkauboy, aaemnnosttv, alessandrotesoro, anhskohbo, balbuf, BeAPI, binarygary, bradp, brightoak, danielbachhuber, danilomaccioni, diggy, getshifter, eriktorsner, ernilambar, fisele, grappler, guillaumemolter, iandunn, johnbillion, jorgeatorres, kouratoras, markri, mattgrshaw, miya0001, mustafauysal, nyordanov, ocean90, petenelson, polevaultweb, pressbooks, rahulsprajapati, runcommand, rxnlabs, shulard, swissspidy, szepeviktor, taianunes, tnorthcutt, trendwerk, trepmal, veganista, welaika

You can browse the full list of resolved issues on GitHub.