Install WP-CLI into a separated folder

WP-CLI (http://wp-cli.org/) is a great commandline tool to manage your WordPress installation. It has countless commands. For example to:

  • change database settings
  • clear the cache
  • manage comments and posts
  • install plugins

The “normal” installation is well documented on the project page. But I prefer to store my project tools (f.e.: vagrant, coposer, etc.) in a different tool folder that is separated from the WordPress installation.

To use wp-cli you have to take the following steps:

  1. Download the source into a folder where you wish to use the tool (f.e. ):
  2. Now you can call wp-cli like that

    from within the install folder.
  3. Make wp globally available, so you can use it everywhere in your product structure:


    This step has to be repeated after every update!
  4. Now you can use wp as a “normal” command (but in my case I have to add the path param every time)
  5. As an alternative you can add a bash alias for the wp command with the path param (see command above):
    1. open .bash_aliases to edit it
    2. add the following line

      Now you can call wp without the path param from any path within your project.
  6. Call $> wp help  to get information about usage

One thought on “Install WP-CLI into a separated folder

Leave a Reply

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.