Jump to content
mrreboot

WP-CLI - A command line interface for WordPress

Recommended Posts

Posted

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.

Requirements

UNIX-like environment (OS X, Linux, FreeBSD, Cygwin)

PHP 5.3.2 or later

WordPress 3.4 or later

First, download wp-cli.phar using wget or curl:

wget https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Then, check if it works:

php wp-cli.phar --info

To be able to type just wp, instead of php wp-cli.phar, you need to make the file executable and move it to somewhere in your PATH. For example:

chmod +x wp-cli.phar
mv wp-cli.phar /usr/bin/wp

Now try running wp --info.

MAMP

If you’re using MAMP, you will probably get a MySQL error, because the php found in your PATH is not the same as the PHP used by MAMP. Here is one way to fix it.

Also see Alternative Install Methods.

Tab completions

WP-CLI also comes with a tab completion script for Bash. Just download wp-completion.bash and load it from ~/.bash_profile:

source /FULL/PATH/TO/wp-completion.bash

(Don’t forget to run source ~/.bash_profile afterwards)

Using

Go into a WordPress root folder:

cd /var/www/wp/

Typing wp should show you output similar to this:

Available commands:
wp blog create|delete
wp cache add|decr|delete|flush|get|incr|replace|set|type
wp comment create|delete|trash|untrash|spam|unspam|approve|unapprove|count|status|last
wp core download|config|is-installed|install|install-network|version|update|update-db
wp db create|drop|reset|optimize|repair|connect|cli|query|export|import
wp eval-file
...

See 'wp help <command>' for more information on a specific command.

More at - Command line interface for WordPress | WP-CLI

Wiki - https://github.com/wp-cli/wp-cli/wiki/_pages

Download - GitHub Link

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...