Sabuj Kundu 30th Nov 2026


WordPress plugin development involves working with more than just PHP source files. Modern plugins often include third-party dependencies, compiled JavaScript and CSS, development tools, test files, and generated assets. When running WordPress Plugin Check (PCP), scanning every file in a plugin directory may produce findings that are irrelevant to the actual plugin code. This is where the .pcpignore file becomes useful.

In this guide, we will explain what .pcpignore does, how to configure custom file and directory exclusions, and how to enable it when running WordPress Plugin Check through WP-CLI.

What Is .pcpignore in WordPress Plugin Check?

.pcpignore is a plain-text configuration file supported by WordPress Plugin Check that allows developers to specify files and directories to exclude from file-based code scans. It provides a convenient way to customize local and continuous integration (CI) testing without modifying Plugin Check itself.

For example, a WordPress plugin may contain third-party libraries inside a vendor directory, JavaScript dependencies inside node_modules, compiled assets inside a build directory, and test fixtures that are not relevant to production code analysis. Instead of scanning all these files, developers can configure .pcpignore to exclude them.

It is important to understand that .pcpignore excludes files and directories from file-based scans. It does not disable individual Plugin Check rules or automatically suppress every finding associated with an excluded path.

Why Should WordPress Plugin Developers Use .pcpignore?

As WordPress plugins become more sophisticated, their directory structures become more complex. Developers frequently use Composer, npm, build tools, JavaScript frameworks, and external libraries to manage their projects.

These dependencies and generated files are not always written by the plugin developer. Scanning them alongside the actual plugin source code can produce unnecessary findings and make it harder to identify issues that need attention.

Using .pcpignore offers several advantages:

  • Exclude third-party dependencies: Avoid scanning external libraries maintained by other developers.
  • Skip generated assets: Exclude compiled JavaScript, CSS, and source map files when appropriate.
  • Reduce irrelevant findings: Focus on files that belong to your plugin’s actual implementation.
  • Improve development workflows: Keep local Plugin Check scans focused and easier to review.
  • Share configurations: Maintain consistent exclusion rules across developer machines and CI environments.

How to Create a .pcpignore File

Creating a .pcpignore file is straightforward. Navigate to your WordPress plugin’s root directory and create a new plain-text file named .pcpignore.

For example, consider the following plugin directory structure:

my-plugin/
├── my-plugin.php
├── includes/
├── admin/
├── public/
├── vendor/
├── node_modules/
├── build/
├── assets/
├── tests/
├── README.md
└── readme.txt

You can create the following .pcpignore configuration:

# Third-party dependencies
vendor/
node_modules/

# Compiled assets
build/

# Development and testing
tests/
.github/

# Source maps
*.map

# Minified assets
*.min.js
*.min.css

Save the file in the plugin root, alongside the main plugin PHP file. Plugin Check will use these rules when you explicitly enable the --use-pcpignore option.

.pcpignore Syntax and Configuration Rules

The configuration format is intentionally simple. Each non-empty, non-comment line represents a file or directory path relative to the plugin root.

1. Excluding directories

Use a trailing slash to identify a directory that should be excluded.

vendor/
node_modules/
build/
tests/

These entries exclude matching directories at the top level of the plugin. Directory exclusions are anchored to the plugin root, so docs/ does not automatically exclude a nested directory such as includes/docs/.

2. Excluding individual files

For individual files, specify their paths relative to the plugin root without a trailing slash.

debug.php
composer.lock
assets/generated-config.json

3. Using wildcard patterns

Wildcard characters are supported for matching files. The asterisk (*) matches variable-length character sequences, while the question mark (?) matches a single character.

*.map
*.min.js
*.min.css
temp-?.php

4. Adding comments

Lines beginning with # are treated as comments. You can use comments to organize your exclusion rules and explain why certain paths are excluded.

# Composer dependencies
vendor/

# JavaScript dependencies
node_modules/

# Generated assets
build/

5. Empty lines

Empty lines are ignored, so you can organize the configuration into readable sections.

Important: Single-file WordPress plugins are not supported because they do not have a dedicated plugin directory in which to place a .pcpignore file.

How to Enable .pcpignore with WP-CLI

Creating a .pcpignore file does not automatically activate its exclusions. You must explicitly enable the feature when executing the Plugin Check command using the --use-pcpignore option.

Basic WP-CLI command

wp plugin check my-plugin --use-pcpignore

Replace my-plugin with your actual plugin identifier or provide the plugin’s local directory path.

Check a plugin using its local directory path

wp plugin check /path/to/my-plugin --use-pcpignore

For example, on a Windows development environment using XAMPP:

wp plugin check C:\xampp\htdocs\wordpress\wp-content\plugins\my-plugin --use-pcpignore

Export Plugin Check results as JSON

You can combine custom exclusions with the available output formats.

wp plugin check my-plugin --use-pcpignore --format=json

Export selected results as CSV

wp plugin check my-plugin --use-pcpignore --format=csv --fields=code,message

Other Useful Plugin Check CLI Options

WordPress Plugin Check provides several additional command-line arguments that can be combined with --use-pcpignore.

Exclude additional directories

wp plugin check my-plugin --use-pcpignore --exclude-directories=cache,logs

This allows you to exclude additional directories directly from the command without adding them to the configuration file.

Exclude additional files

wp plugin check my-plugin --use-pcpignore --exclude-files=debug.php,temp.php

Ignore specific result codes

wp plugin check my-plugin --use-pcpignore --ignore-codes=missing_composer_json_file

The --ignore-codes argument is different from .pcpignore. It ignores specific Plugin Check finding codes rather than excluding files from file-based scans.

Exclude specific checks

wp plugin check my-plugin --exclude-checks=i18n_usage,late_escaping

Use this option when you intentionally want to skip particular checks. It should not be confused with file and directory exclusions.

.pcpignore vs –exclude-directories vs –ignore-codes

Although these WP-CLI options may appear similar, they serve different purposes. Understanding the differences helps you configure Plugin Check correctly.

Option Purpose
--use-pcpignore Applies file and directory exclusions defined in the plugin’s .pcpignore file.
--exclude-directories Excludes additional directories directly through the CLI command.
--exclude-files Excludes additional files directly through the CLI command.
--ignore-codes Ignores specific Plugin Check finding codes.
--exclude-checks Prevents selected Plugin Check rules from running.

Another important distinction is that file-based exclusions do not suppress plugin-level findings. For example, excluding a directory does not automatically resolve a finding that your plugin is missing a required metadata file.

Should You Commit .pcpignore to Your Git Repository?

Yes. If your development team uses a shared exclusion configuration, committing .pcpignore to Git can help maintain consistent local and CI testing environments.

However, there is an important distinction between local development scans and official WordPress.org compliance checks.

The --use-pcpignore option is intended for local and CI scans. WordPress.org scans must not use this option. Excluding a file from your local scan does not mean that the file is exempt from WordPress.org plugin directory requirements.

For this reason, maintain two testing workflows:

  • Local development: Enable --use-pcpignore to avoid unnecessary scanning of generated files and third-party dependencies.
  • Submission readiness: Run a complete compliance scan without custom exclusions and investigate all relevant findings.

This approach helps maintain an efficient development process while ensuring that your plugin is properly reviewed before submission.

Recommended .pcpignore Configuration for WordPress Plugin Developers

There is no universal exclusion configuration suitable for every WordPress plugin. The correct configuration depends on your project structure and build workflow.

For a typical plugin that uses Composer, npm, and a development environment, you can start with the following configuration:

# Third-party dependencies
vendor/
node_modules/

# Build and distribution directories
build/
dist/

# Development files
tests/
.github/

# Generated source maps
*.map

Review every exclusion carefully. Do not exclude your own production PHP code, plugin bootstrap files, readme files, or other files that need to be validated for WordPress.org compliance.

Also remember that excluding a directory from a scan does not remove it from your plugin ZIP package. Packaging and distribution should be managed separately.

Conclusion

The .pcpignore feature makes WordPress Plugin Check more flexible for plugin developers working with modern development tools and complex plugin structures. It allows you to define custom file and directory exclusions without changing the Plugin Check source code or disabling individual checks.

By combining a well-maintained .pcpignore file with WP-CLI and a separate full compliance testing workflow, you can make your development process more efficient while keeping WordPress.org submission requirements in focus.

If you develop WordPress plugins, make Plugin Check part of your regular development and release workflow rather than waiting until the final submission stage.

Need Help Building a WordPress Plugin?

Looking for experienced WordPress developers to build, extend, or maintain your WordPress plugins? Codeboxr has been developing WordPress solutions since 2011, helping businesses build powerful plugins, custom applications, and scalable digital products.

Whether you need a custom WordPress plugin, an existing plugin enhanced, or a complete web application, our team can help turn your requirements into a production-ready solution.

Contact Codeboxr to discuss your next project.

Frequently Asked Questions

1. What does .pcpignore do in WordPress Plugin Check?

.pcpignore allows developers to exclude specific files and directories from file-based Plugin Check scans. It is useful for excluding third-party dependencies, generated assets, and development-only files.

2. Where should I put the .pcpignore file?

Create the .pcpignore file in the root directory of your WordPress plugin, alongside its main plugin PHP file.

3. Is .pcpignore enabled by default?

No. You must explicitly enable it when running WP-CLI by adding the --use-pcpignore argument to your wp plugin check command.

4. Can I use .pcpignore with the WordPress admin Plugin Check interface?

The documented .pcpignore option is a WP-CLI feature. Enable it through the command-line argument --use-pcpignore.

5. Does .pcpignore exclude files recursively?

No. Entries are anchored to the plugin root. For example, docs/ excludes a top-level docs directory, not every nested directory named docs.

6. Can I use wildcards in .pcpignore?

Yes. The configuration supports * and ? wildcards for matching files. For example, *.map can exclude matching source map files.

7. Does .pcpignore suppress all Plugin Check warnings?

No. It excludes files and directories from file-based scans. It does not suppress plugin-level findings or disable individual Plugin Check rules.

8. Can I use .pcpignore for WordPress.org plugin submissions?

You should not use the --use-pcpignore option for WordPress.org scans. It is intended for local and CI testing, not for bypassing official plugin directory requirements.