2015 is an exciting time for WP-CLI. WP-API is days away from 2.0-beta1, and brings with it a powerful new interface to WordPress. In the near future, we’ll start exploring how WP-CLI can use WP-API internally. If all goes well, WP-CLI could see just one more 0.x.0 release before the big 1.0.0.
Plugin scaffolding
wp plugin scaffold is a great way to get started on your next WordPress plugin. It automates many procedural steps you can easily forget to do, or need to copy and paste out of another plugin. v0.19.0 brings these improvements:
bin/install-wp-tests.shwill use either cURL or wget, depending on which is available. The script is also more fault tolerant.- Use the
--dir=<path-to-dir>argument to scaffold your new plugin to an arbitrary directory (e.g. mu-plugins or a theme folder). - For custom projects, use the
--activate-networkflag to network activate the plugin after creation. - Generates a Gruntfile with two helpful tasks:
grunt readmeto build aREADME.mdfrom yourreadme.txt, andgrunt i18nto create a.potfile. - The default
.travis.ymlhas increased maximum tested PHP version to 5.5, is more smart about the build matrix it generates, and changes notifications preferences to only email developers on build failures.
Other changes in v0.19.0
Enhancements:
wp option listlists all options, or searching for specific options based on a pattern. Use--format=total_bytesto get the total bytes for the matching options.- Use
--all-tablesflag forwp search-replaceto perform replacements against all tables in the database. In 0.17.0, we changed the behavior ofwp search-replaceto only affect tables registered to$wpdb. This new flag permits users to opt-in to all tables. - When scaffolding a child theme, the parent theme’s stylesheet is enqueued, instead of being loaded via
@import. - Added a
wp core language updatecommand to update language files. - Added a
--dashiconargument towp scaffold post-typewhich will specify the icon for the post type. - Added a
--sassifyargument towp scaffold _sto download the SASS version of_s. - MySQL binary commands execute with
--no-auto-rehashfor a substantial performance boost on larger databases. - On export, taxonomy terms with missing parents are explicitly identified to make them easier to fix.
- When updating an option or post/user/comment meta and the supplied value is the same as the stored value, the success message indicates such.
- Added
--format=idstowp post term list. - Added
--skip-deleteflag towp media regenerate. This is helpful on sites where thumbnails might’ve been linked to within post content. Skipping deletion prevents breaking image references. - Added
after_invokehook for any post-command execution tasks. - Supports filtering by site value in
wp site list. - Added archive/unarchive, activate/deactivate and spam/not-spam subcommands to
wp site. - Added a summary table to output of
wp theme updateandwp plugin update. This makes it easier to parse the final results when you’re updating a number of themes or plugins in one go. - On multisite, user creation is run through
wpmu_validate_user_signup()andwpmu_create_user(), which perform multisite-specific validation rules. - The object cache is periodically cleared on import to prevent excess memory usage.
- Nightly builds are accompanied by checksums.
Bug fixes:
- Introduces
\WP_CLI\Utils\get_flag_value()helper function to fix a systemic problem throughout WP-CLI. Read through this issue for the full details. - Provides a human-friendly error when an invalid class is specified for a command. The prior behavior was to fatal error.
- Correctly sets
sslverifyargument when testing WP-Cron. - Importer throws a hard error if process to import a file returns
WP_Error.create_author_mapping_file()usesWP_Errorto report that an author mapping file needs to be updated. However, when importing a directory of WXR files, the prior logic to useWP_CLI::warning()means the second file will use the author mapping file of the first, which should’ve been edited. - Comment meta values are wrapped in CDATA tags on export.
wp core multisite-installandwp core multisite-convertwill properly includedefine( 'WP_ALLOW_MULTISITE', true );constant.- https scheme is honored for the
--urlargument. wp post term listdisplays error for an invalid taxonomy.WP_CLI::error()respects$exitargument.- Provides a human-friendly error when an incorrect version or locale was supplied for
wp core downloadThe prior behavior was to fatal error. wp cron event schedulerespects the<next-run>argument.- Child themes aren’t permitted to be activated without their parent installed.
- Themes are network enabled based on stylesheet value, not template. Previously, it wasn’t possible to network-enable a child theme because of this bug.
You can browse the full list of resolved issues on Github.
Contributors to this release: 2ndkauboy, acusti, bobbywalters, bmackinney, danielbachhuber, francescolaffi, heiglandreas, hirozed, jeichorn, johnbillion, joshbetz, jpry, keeth, mavin, morganestes, mwithheld, nyordanov, rodrigoprimo, sebastiaandegeus, szepeviktor, wrnx, yivi
