Phew, it’s finally here! Although there are not that many new features, we had a lot of work being done behind the scenes, to make future releases smoother. A lot of the processes have been improved, and we’ve managed to squash quite a few bugs while doing so.
A team of 57 contributors has collaborated on this release to get 347 pull requests merged. I’ll briefly go over some of the more noteworthy stuff, but as always, you can also skip directly to the detailed changelog or examine the breaking changes section if you’re impatient.
- Thrijith Thankachan (@thrijith) is from Surat, India. He works for rtCamp as a WordPress Engineer and he is the developer behind the two new commands
WP-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/ code standard
Through the initiative of @jrf, and with the outstanding help from @thrijith, @wojsmol & @williampatton, we now have a WP-CLI code standard that we can enforce.
For any package, you can just run
composer phpcs to verify that your code meets the CS requirements. Basic formatting issues can be automatically corrected through
vendor/bin/phpcbf (a Composer script will soon follow for that).
The goal of this big effort is to reduce the back & forth on pull requests and thus reduce the maintenance burden. For most pull requests, whitespace issues and code style issues represent the bulk of the time and effort required by the maintainers. With enforced and automated coding standards, everyone saves time and the discussion more often revolves around the actual logic that solves the problem, instead of alignment issues and spacing rules.
This is all pretty fresh, so stay tuned while more extensive documentation and updates to the tooling will follow.
New command to manage aliases
wp cli alias has finally grown up and has become a complete CRUD interface for managing your WP-CLI aliases. You can
alias list to retrieve your current configuration,
alias get to retrieve an individual alias, and
alias add|update|delete to make changes.
While experimenting with these commands, please remember that you need to work around the already active global parameters. This is why we had to add a prefix (
--set-<flag>) to all the flags that let you configure the aliases. So, updating the SSH Secure SHell - a protocol for securely connecting to a remote system in addition to or in place of a password. connection string for an alias is done through
alias update <key> --set-ssh=<ssh>. If you would use
--ssh instead to configure it, you’d actually immediately connect to that SSH target instead.
# List alias information.
$ wp cli alias list
@all: Run command against every registered alias.
# Get alias information.
$ wp cli alias get @dev
# Add alias.
$ wp cli alias add prod --set-ssh=login@host --set-path=/path/to/wordpress/install/ --set-user=wpcli
Success: Added '@prod' alias.
# Update alias.
$ wp cli alias update @prod --set-user=newuser --set-path=/new/path/to/wordpress/install/
Success: Updated 'prod' alias.
# Delete alias.
$ wp cli alias delete @prod
Success: Deleted '@prod' alias.
New command to control maintenance mode
WP-CLI now lets you enable or disable the WordPress maintenance mode with the two simple commands
maintenance activate and
maintenance deactivate. You can query the current status with
maintenance status (for humans) or
maintenance is-active (for easy shell scripting).
# Activate Maintenance mode.
$ wp maintenance-mode activate
Enabling Maintenance mode...
Success: Activated Maintenance mode.
# Deactivate Maintenance mode.
$ wp maintenance-mode deactivate
Disabling Maintenance mode...
Success: Deactivated Maintenance mode.
# Display Maintenance mode status.
$ wp maintenance-mode status
Maintenance mode is active.
# Get Maintenance mode status for scripting purpose.
$ wp maintenance-mode is-active
$ echo $?
eval-file had a small, innocuous tweak. When it encounters a “shebang“, a first line in a file that starts with
#!, it will strip that line and try to run the rest of the file through PHP 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. http://php.net/manual/en/intro-whatis.php.’s
For folks not used to working in Unix shells, that might sound rather useless, but this shebang is actually a construct that your shell understands, and that lets you tell the shell how to execute the file.
As an example, here’s a file that contains such a shebang and actually points to WP-CLI’s
#!/bin/env wp eval-file
With that file structure, you can now rename that script file to something like
blogname and make it executable. It now behaves like any other shell tool, and will use WP-CLI as a shell framework for retrieving the current blog’s name.
Have fun experimenting with this new functionality, and don’t forget to share the more interesting use cases you can think of with the rest of the community!
While going through the code to make it fit for actually enforcing our new WP-CLI coding standard, we decided to rename some of the more internal functions, methods and properties to make the experience more consistent.
Although we took great care to figure out what we could safely rename and what needed to stay intact, there might be some edge cases where people are nevertheless directly coupling to some bit of internal code.
This is mostly relevant if you
extend one of the WP-CLI classes to override default behavior.
Removal of framework files from test package
The test package included a few framework files that were used to make the FeatureContext logic work. However, as
wp-cli/wp-cli was a hard requirement for
wp-cli/wp-cli-tests anyway, we removed these framework files and had the test package pull them in through the dependency.
In case you were directly coupling your code to these files as they were found in
wp-cli/wp-cli-tests (which is unlikely), then you’ll have to change your code to refer to these same files in the
wp-cli/wp-cli package. See the pull request for more details.
Consistent display of serialized meta 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. values
Serialized data has been displayed very inconsistently, with some commands showing them as is (
option list), and some commands unserializing them automatically for display (
post meta list).
We’ve changed this so that they all show the values as they are stored, to avoid surprises.
This is a breaking change, however, and if you happened to rely on the automatic unserialization, you’ll be glad to hear that the affected commands now provide an optional
--unserialize flag to get back to the old behavior. You can even put this flag into your global config to permanently stick with the old behavior.
Affected commands are:
comment meta get|list,
network meta get|list,
post meta get|list,
user meta get|list.
Complete change log
- Implement CS checking based on the
- Add PHP 7.3 to Travis CI build matrix
- Move PHP 5.4 tests from
- Bundle new maintenance-mode command [#113]
- Add a GitHub 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 be the repository owner. https://github.com/ setting for label to
- Try removing “ignore-platform-reqs” from Dependencies.yml [#72]
dependencies.yml file to define auto-updates [#70]
- Always reattach subcommands [#5203]
- Add warning message to let the user know when
WP_CLI_SSH_PRE_CMD is in use [#5197]
aliases subcommand for backwards compatibility [#5194]
- Avoid double registration of commands [#5193]
- Add default titles to release checklists [#5168]
- Limit ranges of PHP versions in Composer [#5142]
- Add checklists for regular and patch releases [#5141]
- Add flags to include / exclude views in
array_column() shim, because package is abandoned [#5126]
- Add command to manage aliases [#5122]
- Introduce ability to override
wp-config.php path with env var
- Support persistent MySQL 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/. connections [#5115]
- Fixed documented return type for
FileCache::export() not ensuring parent directories exist for
ext-readline to ‘suggest’ instead of a hard requirement [#5102]
- Update docblock for
add_command() to properly reflect the return value [#5099]
- Fix failing test under WP 5.1 [#5094]
parse_str_to_argv() regex to be more accurate [#5090]
- Update ISSUE_TEMPLATE [#5078]
- Ensure cache directories are accessible [#5068]
dependencies.yml file to define auto-updates [#5066]
WP_CLI::has_config() method [#5063]
- Change to “Happy publishing.” per change in core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. [#5059]
- Adapt outdated links in
- Fix typo: Autolaoder => Autoloader [#5055]
- Update example of
wp config create [#317]
- Update link of
backwpup plugin 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 [#315]
- Update release checklist documentation to point to the issue templates [#306]
wp cli info as first environment info [#305]
- Document the
<scheme> part of the
--ssh flag [#299]
- Add documentation for the
WP_CLI_CUSTOM_SHELLenvironment variable [#292]
- Change references to paths being in
- Update roadmap [#287]
- Add instructions for checking additional configuration files for PHP
- Update the ‘using a custom PHP binary’ link [#285]
- Update link to command list in Quick Start [#282]
- Add a note about potential connection issues when using MySQL >= 8.0. [#280]
- Composer installation instructions are dated and incorrect [#279]
- Update broken links on Command Cookbook page [#276]
- Switch to githubusercontent per other submission [#322]
- pt_BR – Version update and minor adjustments [#321]
- Redirect blog to site [#320]
- Make soft change detection more flexible [#41]
- Add backslash to the regex for matching Windows paths correctly [#39]
- Update template based on latest version [#88]
Happy blogging. to
Happy publishing. in
wp-config.php template [#82]
- Replace instances of
- Change to “Happy publishing.” per change in core [#103]
- Modify tests to correctly verify
--force-regex flag [#50]
- Allow deleting multiple options at once [#247]
- Fix logic error in presence of ‘site meta’ check [#244]
- Add count to post-type and taxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies. commands [#241]
- Migrate term from a taxonomy to another one [#234]
- Include ‘supports’ field when fetching a single post type [#233]
- Check for
--post_content is used [#189]
- Strips out
#! /bin/bash and similar at the beginning of PHP files [#35]
- Fix handling of
eval()‘d code. [#38]
- Identify non-writable directory as such [#54]
- Add the
--page parameter to the
theme search command [#167]
- Allow deleting the currently active theme [#158]
- Display warning in plugin list info if plugin version is higher than expected [#157]
- Fix success message example on plugin uninstall [#148]
- Handle extension activation for WP error or extension not found [#146]
- Set Language header The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. directly to prevent exceptions [#150]
- Fix make-pot tests [#135]
- Improve language handling when creating JSON files [#133]
- Add support for nested theme folders [#130]
- Prevent possible PHP notice in IterableCodeExtractor [#129]
- Extend PotGenerator to improve plural forms output [#128]
- Remove project header comments for comments audit [#123]
- Refactored aspects of the image collection and determination of sizes [#103]
- Adapt framework requirement [#103]
- Update success message position [#29]
--show-grant argument to
cap list and
--field=<field> support to listing roles [#17]
- Prevent creating unregisterable blocks due to invalid plugin slug [#203]
dependencies.yml to plugin
- Add DeployHQ
.deployignore to ignored files in
- Update links to blocks documentation [#199]
- Swapped out the .dev Google TLD for the .test RFC protected domain in doc examples [#107]
- Better explain the
--basic flag [#23]
- Close already opened process while prompting [#36]
- Add possibility to change the shell binary [#33]
- Fix a bug where adding superadmins would crash if none existed before [#22]
- Fix parsing of escaped quotes [#16]
- Normalize the newline to prevent an issue coming from OSX [#14]
- Change to “Happy publishing.” per change in core [#13]
.gitattributes file [#12]
@abhijitrakas, @afragen, @ajitbohra, @amieiro, @andreamk, @andrewminion-luminfire, @anthony-curtis, @atanas-angelov-dev, @cwales92, @D9Dan, @danielbachhuber, @DavidHickman, @dependencies[bot], @desrosj, @diggy, @emirpprime, @felipeelia, @jankimoradiya, @jbwtech, @jcomack, @jonathanbardo, @jrfnl, @Juberstine, @killua99, @kimdcottrell, @korikori, @kuoko, @kushalraha, @lanresmith, @localheinz, @luc122c, @man4toman, @mkaz, @mrmakadia94, @msaggiorato, @Mte90, @musicaljoeker, @nickdavis, @nishitlangaliya, @Nomafin, @pattonwebz, @rosswintle, @salcode, @shashank3105, @Sidsector9, @spicecadet, @ssnepenthe, @swissspidy, @thrijith, @tomjn, @tyrann0us, @Umang8, @villuorav, @websupporter, @wojsmol, @XedinUnknown