Always require a specific file when running WP-CLI

If you like my WordPress work, check out my new plugin, Bylines. Thanks!

WP-CLI can read default options from a few configuration file types (when present):

  1. wp-cli.local.yml file inside the current working directory (or upwards).
  2. wp-cli.yml file inside the current working directory (or upwards).
  3. ~/.wp-cli/config.yml file (path can be changed by setting the WP_CLI_CONFIG_PATH environment variable).

To always require a specific file when running WP-CLI, you can include a require statement in one of the aforementioned configuration files like so:

require:
  - path/to/file.php

Learn more about WP-CLI’s config system on the WP-CLI website.