WordPress at a glance
Home Handbook WP-CLI Commands

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:

.distignore
.editorconfig
.git
.gitignore
.travis.yml
circle.yml

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

Usage

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

You can specify global options and the following:

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

Source code of the commands