WP CLI

Install

wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
# wp --info

Open the .zshrcfile and add the following line to the bottom of the file:

autoload bashcompinit
bashcompinit
source /home/$USER/wp-completion.bash

Or execute the commands below:

echo "autoload bashcompinit" >> ~/.zshrc 
echo "bashcompinit" >> ~/.zshrc 
echo "source /home/$USER/wp-completion.bash" >> ~/.zshrc 

Then reload your ZSH

source ~/.zshrc

Docker Container + Bash auto-completion

Dockerfile
...

RUN wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
RUN chmod +x wp-cli.phar
RUN mv wp-cli.phar /usr/local/bin/wp

...

Option

Get current site URL

Cache

User

Search and replace

Only for specific tables

Production multisite to a local database

Example 2:

Restore database

Backup database

Deactivate plugin

Last updated

Was this helpful?