Create WP-CLI Aliases

IF you use the same commands often you can save them as aliases so that you have them always available.

For example, the following commands will check if WP core, installed plugins and themes have updates available:

wp core check-update
wp plugin list --update=available
wp theme list --update=available

You can combine the commands into a one-liner:

wp core check-update && wp plugin list --update=available && wp theme list --update=available

and you can create an alias for this command:

alias check-all='wp core check-update && wp plugin list --update=available && wp theme list --update=available'

so you can simply run: check-all

This will create an alias for the current shell session, meaning that when you log in next time and want to use the command check-all it will not recognize it.

To save an alias for future use add it to your ~/.bashrc or ~/.zshrc  file.

Was this post helpful?

Leave a Comment