Title: WP-CLI – Page 17 – The command line interface for WordPress

---

 [  ](https://profiles.wordpress.org/scribu/) [scribu](https://profiles.wordpress.org/scribu/)
12:00 am _on_ November 10, 2012      

# 󠀁[Interactive WordPress Debugging](https://make.wordpress.org/cli/2012/11/10/wp-shell/)󠁿

A new command [landed](https://github.com/wp-cli/wp-cli/pull/89) in 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/](http://wp-cli.org/)
[https://make.wordpress.org/cli/](https://make.wordpress.org/cli/) a few days ago,
called `shell`. It was inspired by an older project called [wpshell](https://code.trac.wordpress.org/browser/wpshell).

When you run `wp shell`, a REPL will start, in which you can run any WordPress function.

The major advantage over `wp eval` and `wp eval-file` is that it’s interactive: 
you immediately see the result of the previous command; it’s also stored in the 
special `$_` variable, which you can use in the next command and so on.

Here’s a contrived example session:

    ```
    scribu@air:~/wp/core$ wp shell
    Type "exit" to close session.
    wp> get_bloginfo('wpurl')
    'http://wp.dev/core'
    wp> $_ . '/feed/'
    'http://wp.dev/core/feed/'
    wp> exit
    scribu@air:~/wp/core$
    ```

`wp shell` will be available in the 0.7 release of WP-CLI, but if you want to try
it out right now, clone the [latest version](https://github.com/wp-cli/wp-cli) from
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/](https://github.com/).
If you have suggestions for making it better, don’t hesitate to open issues and 
pull requests.

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2012%2F11%2F10%2Fwp-shell%2F%23respond&locale=en_US)

 [  ](https://profiles.wordpress.org/scribu/) [scribu](https://profiles.wordpress.org/scribu/)
12:00 am _on_ November 5, 2012      

# 󠀁[New Home](https://make.wordpress.org/cli/2012/11/05/new-home/)󠁿

Welcome to the new website for the 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/](http://wp-cli.org/) [https://make.wordpress.org/cli/](https://make.wordpress.org/cli/)
project!

wp-cli already has a public [code repository](https://github.com/wp-cli/wp-cli),
an [issue tracker](https://github.com/wp-cli/wp-cli/issues) and a [wiki](https://github.com/wp-cli/wp-cli/wiki).
The only thing that was missing was a blog for publishing release notes and other
news.

Since 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/](https://github.com/) has built-in support for [Jekyll](https://github.com/mojombo/jekyll/wiki),
I decided to use that. The code for this website is also public: [github.com/wp-cli/wp-cli.github.com](https://github.com/wp-cli/wp-cli.github.com)

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2012%2F11%2F05%2Fnew-home%2F%23respond&locale=en_US)

 [  ](https://profiles.wordpress.org/scribu/) [scribu](https://profiles.wordpress.org/scribu/)
12:00 am _on_ September 5, 2012      

# 󠀁[Version 0.6](https://make.wordpress.org/cli/2012/09/05/version-0-6/)󠁿

Got a lot of exciting news regarding 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/](http://wp-cli.org/) [https://make.wordpress.org/cli/](https://make.wordpress.org/cli/),
so let’s get right into it:

### The Reach

> How To Install wp-cli on Dreamhost: you don’t need to, it’s already available.
> Just type “wp –help” in your shell. [#140charlongtutorials](https://twitter.com/search/%23140charlongtutorials)
> — Ozh Richard (@ozh) [September 4, 2012](https://twitter.com/ozh/status/243086032868896769)

Besides Dreamhost, it’s used and recommended by the WordPress.comWordPress.com An
online implementation of WordPress code that lets you immediately access a new WordPress
environment to publish your content. WordPress.com is a private company owned by
Automattic that hosts the largest multisite in the world. This is arguably the best
place to start blogging if you have never touched WordPress before. [https://wordpress.com/](https://wordpress.com/)
VIP team to all their clients.

Oh, and it’s also used in a Juju Charm for [deploying WordPress in the cloud](http://jujucharms.com/charms/precise/wordpress).
😀

### The `--require`

An interesting but easily overlooked feature is the new `--require` global parameter.
Say you wrote a custom command called `chores` for yourself:

    ```
    WP_CLI::add_command( 'chores', 'My_Chores' );

    class My_Chores extends WP_CLI_Command {

        function do_laundry() {
            ...
        }

        function wash_dishes() {
            ...
        }
    }
    ```

Now, where do you put this code, so that WP-CLI can reach it? You could put it in
a 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/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party., but if you have multiple WP installations,
you’d have to install that plugin on each one. You could put it inside one of the
WP-CLI directories, but that creates problems when you want to update. Here’s what
you could do instead:

    ```
    wp --require=/path/to/chores.php chores do_laundry
    ```

The `--require` parameter will load that 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](https://www.php.net/manual/en/index.php)
file at just the right time for the command to work as you’d expect.

### The Manual

The help system has been improved. When you do `wp help core config`, an actual 
man page will show up, with details about each parameter:

![](https://i0.wp.com/make.wordpress.org/cli/files/2012/09/wp-cli-man-page.png?resize
=300%2C273&ssl=1)

Unfortunately, this doesn’t work if you install WP-CLI via the PEAR package, because
PEAR doesn’t know how to handle them. 🙁

### The Changelog

Commands:

 * added `wp post` and `wp post-meta`
 * added `wp user-meta`
 * added `wp blog create`
 * added `wp export`
 * added `wp theme install` and `wp theme update`
 * added `wp transient`
 * added `wp db optimize` and `wp db repair`
 * added `wp db create`, `wp db drop` and `wp db reset`
 * added `wp db import`
 * added `wp core install_network`
 * added `wp core update_db`
 * added `--json` option to several subcommands
 * added `--network` option to `wp plugin activate`
 * fixed `wp plugin update`

Internals:

 * fixed “out of memory” error
 * misc bugfixes and optimizations

You can also browse the full list of [resolved issues](https://github.com/wp-cli/wp-cli/issues?milestone=4&state=closed).

### The Community

Most of the new commands you see in this release were actually implemented by other
people.

Here are all the people that have contributed to this release: [andreascreten](http://github.com/andreascreten),
[dwightjack](http://github.com/dwightjack), [getsource](http://github.com/getsource),
[johnpbloch](http://github.com/johnpbloch), [joshstoik1](http://github.com/joshstoik1),
[kidfiction](http://github.com/kidfiction), [marcoceppi](http://github.com/marcoceppi),
[mgburns](http://github.com/mgburns), [mwilliamson](http://github.com/mwilliamson),
[roelven](http://github.com/roelven), [scribu](http://github.com/scribu), [soulou](http://github.com/soulou),
[tollmanz](http://github.com/tollmanz).

### The Future

The first thing I want to tackle next is revamping the install process. I’m also
thinking of ditching PEAR entirely; it’s just too limited: no man pages, no command
auto-complete etc.

Beyond that, there are a lot of gaps to fill: `wp import`, `wp blog update`, `wp
attachment` anyone?

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2012%2F09%2F05%2Fversion-0-6%2F%23respond&locale=en_US)

 [  ](https://profiles.wordpress.org/scribu/) [scribu](https://profiles.wordpress.org/scribu/)
12:00 am _on_ March 27, 2012      

# 󠀁[Version 0.5](https://make.wordpress.org/cli/2012/03/27/version-0-5/)󠁿

Version 0.5.0 is now available. See [resolved issues](https://github.com/wp-cli/wp-cli/issues?milestone=3&state=closed).

### Changelog

Commands:

 * added `wp user`
 * added `wp core download`
 * added `wp core config`
 * added `wp plugin update --all`

Internals:

 * added `--url` `--path` and `--user` global parameters
 * various bugfixes

Contributors to this release: [andreascreten](http://github.com/andreascreten), 
[ericandrewlewis](http://github.com/ericandrewlewis), [getsource](http://github.com/getsource),
[johnpbloch](http://github.com/johnpbloch), [scribu](http://github.com/scribu), 
[spuriousdata](http://github.com/spuriousdata), [svaj](http://github.com/svaj), 
[wopr42](http://github.com/wopr42).

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2012%2F03%2F27%2Fversion-0-5%2F%23respond&locale=en_US)

 [  ](https://profiles.wordpress.org/scribu/) [scribu](https://profiles.wordpress.org/scribu/)
12:00 am _on_ December 29, 2011      

# 󠀁[Version 0.4](https://make.wordpress.org/cli/2011/12/29/version-0-4/)󠁿

Version 0.4.0 is now available. See [resolved issues](https://github.com/wp-cli/wp-cli/issues?milestone=2&state=closed).

### Changelog

 * added `wp eval` and `wp eval-file`
 * added `wp export`
 * added `wp core install`
 * fixed `wp core update`
 * added `--dev` flag to `wp plugin install`
 * added `wp plugin uninstall`
 * fixed `wp plugin install` and `wp plugin update`

Contributors to this release: [mwilliamson](http://github.com/mwilliamson), [scribu](http://github.com/scribu),
[tott](http://github.com/tott).

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2011%2F12%2F29%2Fversion-0-4%2F%23respond&locale=en_US)

 [  ](https://profiles.wordpress.org/scribu/) [scribu](https://profiles.wordpress.org/scribu/)
12:00 am _on_ November 6, 2011      

# 󠀁[Version 0.3](https://make.wordpress.org/cli/2011/11/06/version-0-3/)󠁿

Version 0.3.0 is now available.

### Changelog

Commands:

 * added `wp sql`
 * improved `wp option`
 * improved `wp plugin` and `wp theme`
 * added `wp generate`
 * added `wp core version`

Internals:

 * added `--version` special parameter
 * added `--blog` global parameter
 * added bash completion script
 * added pear installer

Contributors to this release: [andreascreten](http://github.com/andreascreten), 
[conatus](http://github.com/conatus), [matiskay](http://github.com/matiskay), [nb](http://github.com/nb),
[scribu](http://github.com/scribu), [toszcze](http://github.com/toszcze).

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2011%2F11%2F06%2Fversion-0-3%2F%23respond&locale=en_US)

## Post navigation

[Newer posts →](https://make.wordpress.org/cli/page/16/?output_format=md)