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):
- aaemnnosttv/wp-cli-login-command - Log in to WordPress with secure passwordless magic links.
- alessandrotesoro/wp-cli-helpscout-docs-parser - Extract helpscout docs articles and categories to build an offline documentation.
- alessandrotesoro/wp-usergen-cli - Generate random users for testing purposes.
- anhskohbo/wp-cli-themecheck - Run Themecheck in WP-CLI.
- BeAPI/wp-cli-light-db-export - Allows you to export big databases with all the tables but not all the data.
- binarygary/db-checkpoint - Treat your DB like a save point in a video game.
- brightoak/wp-cli-envoyer - Invoke an Envoyer deployment via WP-CLI.
- getshifter/wp-cli-shifter - Enables you to import/export your WordPress site for the Shifter.
- eriktorsner/wp-checksum - Verify checksums for themes and plugins.
- iandunn/wp-cli-plugin-active-on-sites - List all sites in a multisite network that have activated a given plugin.
- markri/wp-sec - Checks for WordPress CVE security issues at wpvulndb.com.
- mattgrshaw/wp-installer - Simple commands to install and uninstall WordPress.
- pressbooks/pb-cli - A suite of wp-cli commands for Pressbooks.
- runcommand/assign-featured-images - Assign featured images to posts that support thumbnails.
- runcommand/manifest - Produces an overview of WordPress’ configuration for a high-level understanding of what’s going on inside of WordPress.
- rxnlabs/wp-composer - Manage your WordPress site dependencies using the power of Composer.
- trendwerk/faker - Fake post data with WP-CLI.
- trepmal/blog-extractor - Extract a single blog from multisite.
- trepmal/wp-revisions-cli - Manage revisions.
- welaika/wp-cli-db2utf8 - Downgrade db encoding of a new WP installation to UTF8.
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
- Runsmysqlcheck
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].
- Introduces
wp core config
:- Adds comments to generated
wp-config.php
to better match the one provided by WordPress core [#3312].
- Adds comments to generated
wp core download
:wp core language update
:wp core multisite-(install|convert)
:wp core update-db
:- Ensures
wp core update-db --network --dry-run
is actually dry [#3347].
- Ensures
wp core version
:- Displays default core language in
wp core version --extra
[#3221].
- Displays default core language in
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
:wp package install
wp package uninstall
wp plugin install
:wp scaffold plugin-tests
:wp search-replace
:wp server
:- Supports passing a custom
.ini
file to configure the server [#3330].
- Supports passing a custom
wp site create
:- Use
get_blog_details()
for the site URL when creating a new site to ensure the correct URL is displayed [#3416].
- Use
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
andwp transient delete-expired
to flags ofwp transient delete
[#3389].
- Consolidates
wp user create
:- Prevents email notifications when users are created because email notifications should only be sent when
--send-email
is provided [#3331].
- Prevents email notifications when users are created because email notifications should only be sent when
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 onnocache_headers
filter [#3440]. - Assigns a default
$_SERVER['SERVER_NAME']
to prevent uncaught exception whenwp_mail()
is used [#3449]. - Ignores
url:
inwp-cli.yml
when alias is used, because aliases completely override user, url, path, ssh, and http [#3450]. - Warns when
WP_CLI::launch()
ends up withreturn_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 affectswp 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 inWP_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.