Happy release day!
Today, I’m excited to bring you WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/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 PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. https://www.php.net/manual/en/index.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 multisiteMultisite Multisite is a WordPress feature which allows users to create a network of sites on a single WordPress installation. Available since WordPress version 3.0, Multisite is a continuation of WPMU or WordPress Multiuser project. WordPress MultiUser project was discontinued and its features were included into WordPress core. Advanced Administration Handbook -> Create A Network. network that have activated a given pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party..
- 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 revisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision..
- 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 GitGit Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. Most modern plugin and theme development is being done with this version control system.
https://git-scm.com/ URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org [#3482], .zip file [#3485], or directory path [#3484] as a package.
$ wp package install [email protected]: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– Runsmysqlcheckwith the default--checkoption [#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
--stableto install or reinstall the latest stable version [#3430].
- Introduces
wp core config:- Adds comments to generated
wp-config.phpto better match the one provided by WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. [#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-runis 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 installwp package uninstallwp plugin install:- Removes branch names from directories created for GithubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged by the repository owner. https://github.com/-based ZIPs [#3314, #3451].
wp scaffold plugin-tests:- Uses PHP version specific to Trusty on CircleCI [#3359].
- Uses correct default user for MySQLMySQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com on CircleCI [#3457].
- Uses the latest version of PHPUnit on Travis, depending on PHP version [#3463].
- Adds WordPress Coding StandardsWordPress Coding Standards The Accessibility, PHP, JavaScript, CSS, HTML, etc. coding standards as published in the WordPress Coding Standards Handbook.
May also refer to The collection of PHP_CodeSniffer rules (sniffs) used to format and validate PHP code developed for WordPress according to the PHP coding standards. to newly-scaffolded plugins [#3472].
wp search-replace:wp server:- Supports passing a custom
.inifile 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 themeChild theme A Child Theme is a customized theme based upon a Parent Theme. It’s considered best practice to create a child theme if you want to modify the CSS of your theme. https://developer.wordpress.org/themes/advanced-topics/child-themes/ [#3301].
wp transient:- Consolidates
wp transient delete-allandwp transient delete-expiredto 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-emailis 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
ProcessRunclass out to its own file [#3377, #3422]. - Permits running test suite with
WP_VERSIONenv variable [#3383, #3392]. - Prevents error notice when using
Utilsget_named_sem_ver()with WP versions [#3404]. - Fixes fatal error for failed early database connection by handling
dead_db()error onnocache_headersfilterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. [#3440]. - Assigns a default
$_SERVER['SERVER_NAME']to prevent uncaught exception whenwp_mail()is used [#3449]. - Ignores
url:inwp-cli.ymlwhen alias is used, because aliases completely override user, url, path, ssh, and httpHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. [#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-sigchildoption [#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
optionsfor 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
RecursiveDirectoryIteratorwhen verifying core checksums [#3266]. - Passes slashed data in metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. commands [#3274].
- Ensures appropriate WP-CLI package index URL is used in the
composer.json[#3276]. - Corrects reference of
WP_CLIto use global namespace inWP_CLIUtilsget_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.