Setup tab completions for WP-CLI

Tab completion is a useful time-saving feature of command line interfaces. To enable tab completion for WP-CLI We need to edit the ~/.bash_profile file.

Step 1. In your home directory download WP-CLI tab completion file

curl -O https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash || wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash

Step 2. Edit your ~/.bash_profile

nano ~/.bash_profile

and add the following line: source ~/wp-completion.bash

Save and exit.


Step 3. Source the profile file by running

source ~/.bash_profile

That’s it, now at the terminal just type wp and hit Tab twice to see all tab completions.

Was this post helpful?

Leave a Comment