WP-CLI A command line interface for WordPress

May 1, 2017Blog, Web design, WordPress

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

Installing

Downloading the Phar file is our recommended installation method. Should you need, see also our documentation on alternative installation methods.

Before installing WP-CLI, please make sure your environment meets the minimum requirements:

  • UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment
  • PHP 5.3.29 or later
  • WordPress 3.7 or later

Once you’ve verified requirements, download the wp-cli.phar file using wget or curl:

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Next, check if it is working:

$ php wp-cli.phar --info

To use WP-CLI from the command line by typing wp, make the file executable and move it to somewhere in your PATH. For example:

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

If WP-CLI was installed successfully, you should see something like this when you run wp --info:

$ wp --info
PHP binary:    /usr/bin/php5
PHP version:    5.5.9-1ubuntu4.14
php.ini used:   /etc/php5/cli/php.ini
WP-CLI root dir:        /home/wp-cli/.wp-cli
WP-CLI packages dir:    /home/wp-cli/.wp-cli/packages/
WP-CLI global config:   /home/wp-cli/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 1.1.0

Using

WP-CLI’s goal is to provide a command-line interface for any action you might want to perform in the WordPress admin. For instance, wp plugin install --activate (doc) lets you install and activate a WordPress plugin:

$ wp plugin install rest-api --activate
Installing WordPress REST API (Version 2)(2.0-beta13)
Downloading install package from https://downloads.wordpress.org/plugin/rest-api.2.0-beta13.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'rest-api'...
Success: Plugin 'rest-api' activated.

WP-CLI also includes commands for many things you can’t do in the WordPress admin. For example, wp transient delete --all (doc) lets you delete one or all transients:

$ wp transient delete --all
Success: 34 transients deleted from the database.

For a more complete introduction to using WP-CLI, read the Quick Start guide. Or, catch up with shell friends to learn about helpful command line utilities.

Handbook

Here are some helpful guides and resources for using WP-CLI.

Can’t find what you’re looking for? Open an issue to request improvements.

Guides

References

  • Global parameters – Variables defining how a command is executed, including which WordPress user the command is run as and which WordPress instance the command is run against.
  • Built-in commands – Commands included in every copy of WP-CLI.
  • Package index – Commands maintained and supported by the community.
  • Internal API – Stable utilities considered safe to use in community commands.
  • Documentation standards – Standards for annotating WP-CLI commands.
  • Hosting companies – List of hosting companies where WP-CLI is installed by default.
  • Shell friends – Helpful shortcuts for bash and zsh.
  • Integrated tools – Plugins, wrappers, and other projects that integrate with WP-CLI in some form.

WP-CLI A command line interface for WordPress

Learn more…

David

Graphic and website designer, currently maintaining web servers for existing clients and building websites for new clients. In my free time, I learn about Linux, SSH, and WP-CLI and I’m preparing this blog.

Related Posts

25+ Free Fonts for Your Next Design Project

25+ Free Fonts for Your Next Design Project

Looking for some fresh and creative fonts to spice up your design projects in 2023? You’re in luck! In this blog post, we’ve curated a list of 25 free fonts that you can download and use right away. These fonts are suitable for various purposes such as logos,...

Adobe Photoshop Shortcuts – Infographic

Adobe Photoshop Shortcuts – Infographic

Thanks to Amanda from the Consumer Base that she sent us an ultimate Adobe Photoshop shortcuts cheat sheet. If you are a beginner or want to brush up your knowledge on Adobe Photoshop shortcuts then you are at the right place. Have look at it and let us your thoughts...

20 WordPress Tutorial channels on Youtube

20 WordPress Tutorial channels on Youtube

This post will introduce you a useful list of the 20+ best currently active WordPress tutorial related channels on Youtube. These channels are mostly focused on Tutorials and Guides for Developers and Designers that want to learn all about WordPress. Check them out...

12 AI Tools for Graphic and Website Designers

12 AI Tools for Graphic and Website Designers

Artificial intelligence (AI) is transforming the way designers work, from ideation to execution. AI tools can help designers automate tedious tasks, generate new content, and enhance their creativity. In this blog post, I will introduce AI tools that you can use to...

How to Pair Fonts – Tips and Tools for Perfect Font Combinations

How to Pair Fonts – Tips and Tools for Perfect Font Combinations

Font pairing is the art of choosing two or more fonts that work well together and create a harmonious design. Font pairing can make or break your website, logo, poster, or any other project that involves typography. But how do you pair fonts like a pro? In this...

The Ultimate Guide to Color Palettes

The Ultimate Guide to Color Palettes

Color palettes are collections of colors that work well together and create a harmonious visual effect. They are essential for any design and art project, as they help to convey the mood, message, and style of your work. But how do you choose the right color palette...

Show/Hide Comments (0 comments)
L

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social followers

Articles

Visits

Pin It on Pinterest

Shares