This is a minor release, which contains a single change that fixes many issues.
Changelog
Internals:
- don’t set
WP_ADMINto true and don’t fire the'admin_init'hook.
This is a minor release, which contains a single change that fixes many issues.
Internals:
WP_ADMIN to true and don’t fire the 'admin_init' hook.This is a minor release, which fixes a few regressions.
Commands:
search-replace work with tables that have reserved column names, such as ‘default’option update work correctly for blog_publicscaffold post-typewp plugin update-all --dry-runInternals:
wp help would not display commands defined in pluginsWP_CLI_PHP_ARGS environment variableYou can also browse the list of resolved issues on GitHub.
It’s been two months since the last major release. We didn’t want to wait any longer to show you all the goodies that we packed into this version.
A significant addition in this release is the wp import command, which is the yin to wp export’s yang.
It’s an iteration on Automattic’s WordPress-CLI-Importer.
Here’s a little puzzle: How do you spin up a multisite install, when you already have a wp-config.php file with all the settings?
Run wp core install and then wp core install-network? No. Use a dummy wp-config.php file and then swap in the real one? Probably not. Learn to play jazz, impress Matt and then ask him to fix the multisite install process? Maybe later.
To trick WordPress into submission, you have to do a zillion little hacks, strewn throughout the loading process. We took care of this dirty work for you. Just run wp core multisite-install.
In previous versions, wp help called man internally. Besides not working on Windows, it also had the significant drawback that you had to use a separate tool to compile man pages.
In WP-CLI 0.11, we generate the docs on the fly, using the information from the command PHPDoc.
Remember how in the previous release we suggested using the installer? If you followed that recommendation, it should be very easy to install community packages now.
Commands:
wp core install-network to wp core multisite-convertwp blog to wp site--force flag to wp plugin install and wp theme installwp user get subcommand--format=count to list subcommandswp user commands accept both user logins or user IDs.Internals:
@when before_wp_load annotationapache_modules config key--require= multiple timesWP_CLI::add_man_dir()You can also browse the full list of resolved issues on GitHub.
Contributors to this release: dangardner, danielbachhuber, eugeneware, jmslbam, johnbillion, MiteshShah, om4james, scribu, twratajczak, Veered.
This is a minor release, mainly meant to fix a dependency issue.
Commands:
--format=json, show warning if the value is not a valid JSON stringwp core install-network and other man page fixesInternals:
You can also browse the list of resolved issues on GitHub.
This is a minor, bugxfix-only release.
Commands:
--version handling for wp plugin and wp theme subcommandswp post get.travis.xml file generated by wp scaffold plugin-testsInternals:
You can also browse the list of resolved issues on GitHub.
In the last two and a half months, we’ve added a ton of new features, fixed many bugs and improved our functional test suite.
You can still install WP-CLI by cloning the git repo, but the preferred method is to use the installer, as described on the front page.
The main reason for using the installer is to be able to leverage the optional Boris package, for an enhanced wp shell experience.
Commands:
wp scaffold child-theme subcommandwp media import subcommandwp blog empty subcommandwp post get subcommandwp plugin list and wp theme list subcommands--extra-php flag to wp core config subcommand--label option to wp scaffold post-type and wp scaffold taxonomy--verbose flag to wp export command--fields option to all list subcommandswp home commandwp search-replace: added --skip_columns option; added --network flag; fixed a lot of bugswp theme install: fixed --version parameter being ignoredwp core init-tests: create the test database if necessarywp db: ignore ~/.my.cnf file when running subcommandswp db query: read from STDIN if no parameter is passedInternals:
wp from subdirectoriesWP_ADMIN to true--man flag with --help --gen--json to --format=json everywhereYou can also browse the full list of resolved issues on Github.
Contributors to this release: cyberhobo, daithi-coombes, danielbachhuber, future500, glebis, goldenapples, j3lamp, jmslbam, mwilliamson, om4james, scribu, tlovett1, tolgap, twisty, westonruter.
I foresee a comeback of community commands, but in a better form.
Custom post types and custom taxonomies are the building blocks for advanced functionality. Most of the time, the code for registering them is either copy+pasted from somewhere or it’s saved as a snippet in your text editor.
Now you can do this with WP-CLI, using the wp scaffold command.
The following command generates the code for registering the post type and also for customizing the update messages:
wp scaffold post-type zombie
The following command generates the code for registering the taxonomy to the zombie post type:
wp scaffold taxonomy zombie-speed --post_types=zombie
Then you can add the --raw flag:
wp scaffold post-type zombie --raw
This will only output the code that will register_post_type() without the init action and the update messages.
This is a personal preference. Some ship it within a theme, while others will save it within a plugin. That’s why we have these two flags:
wp scaffold post-type zombie --theme
--theme stores the generated code within your current active theme under a /post-types directory and names a file name zombie.php
wp scaffold post-type zombie --plugin=pluginname
--plugin=plugin-dir-name stores the generated code within the given plugin name.
By default, the code will be output to your terminal (STDOUT) so you could write it to your file of choice:
wp scaffold post-type zombie > ~/project/foo/bar.php
Internationalization by gettext can be achieved through the --textdomain parameter:
wp scaffold post-type zombie --textdomain=my-textdomain
By default when using the --theme, the textdomain will be that of your active theme, and if
using the --plugin flag, the textdomain will be your plugin name.
Enjoy these commands; we hope it will speed-up and ease your development with WordPress!
Version 0.9.0 is now available.
The PEAR channel has been abandoned, and replaced with a much simpler distribution method: you download a single Phar archive. Done.
Of course, installing via git is still possible and encouraged, if you want to hack on WP-CLI.
The front page has up-to-date information about all the supported installation methods.
Commands:
wp media regenerate command. props Viper007Bond and benmay for the initial workwp role commandwp term command--edit flag to wp post createwp scaffold _swp core init-testswp scaffold plugin generate files for unit tests. see the blog post--format parameter to wp user listwp help work without a WP install--force flag to wp core downloadInternals:
--path argument getting ignored when running wp core downloadWP_ADMIN to truewp-config.php filesYou can also browse the full list of resolved issues.
Contributors to this release: danielbachhuber, drrobotnik, erwanlr, goldenapples, jmslbam, leewillis77, nacin, nb, ocean90, scribu, sebastiaandegeus, taupecat.
A few years ago, I came across a very interesting project by Joseph Scott, called PressFS; it exposed WordPress posts as plain text files on your filesystem. This allowed you to use all your favorite command-line tools to manipulate these posts, including editing their content in your favorite text editor.
With WP-CLI 0.9.0-beta, you can do the same thing:
wp post edit 123
Once you run that command, your $EDITOR will open up, pre-filled with the content of the post with ID 123. After you’ve made your changes and quit the editor, WP-CLI will update the post in the database.
Credit goes to goldenapples for implementing it.
One of the reasons so few people take the time to write unit tests for plugins they author is that it’s a chore to set everything up. Besides installing PHPUnit, you also have to set up the WordPress testing library, as well as the actual plugin tests configuration files.
If you’re running WP-CLI 0.9.0-alpha2 or later, there are commands that make the last two steps significantly easier. See the Plugin Unit Tests wiki page for up-to-date usage info.
You can check out the sample-plugin repo to see what a generated plugin looks like.
A shout-out to the people that contributed to benbalter/wordpress-plugin-tests is in order.