The .wpcignore file works like a .gitignore: it allows you to specify files or directories to exclude during the build process, especially when generating ZIP archives via the CLI.

Purpose

When executing build commands, the .wpcignore file is used to determine which files should be excluded from the final ZIP package. This helps avoid including unnecessary files like version control folders, logs, or local development artifacts.

Format

The .wpcignore file is a plain text file containing one pattern per line. It supports glob patterns, making it easy to match files or folders.

Example

.wpcignore
# Exclude Git-related files and folders
.git*

# Exclude all .log files
*.log

# Exclude temporary folders
temp/

Usage

Place the .wpcignore file at the root of your project. During the build process, the CLI will automatically use it to determine what should be excluded from the archive.

Notes

  • Patterns are relative to the root of the project.
  • Empty lines and lines starting with # are treated as comments.
  • Be careful not to exclude required files unintentionally.