wp dist-archive

Create a distribution archive based on a project’s .distignore file.

For a plugin in the wp-content/plugins/hello-world folder, this command creates an archive wp-content/plugins/hello-world.zip for distribution.

You can specify the files or folders that you want to exclude from the archive. It can be done through the file .distignore in the project repository:


Use one command for multiple projects instead of bash script in each project.

Fires before the WP environment is loaded.

Package installation

Use the wp package install command to install the command package. After installation, new command wp dist-archive will appear in the commands list.

wp package install wp-cli/dist-archive-command


wp dist-archive {path} [{target}] [--format={format}]

You can specify global options and the following:

Path to the project in which there is a file .distignore.
The path and file name of the archive. By default, the project directory name plus version (if it could be determined).
Archive format.
Can be: zip, targz.
Default: zip

Source code of the commands