Configuration Files

The root web/wp-config.php is required by WordPress and is only used to load the other main configs. Nothing else should be added to it.

The file to modify for configuration options is config/application.php. This is the file that contains what wp-config.php usually would.

These base configuration options should be production-standard SAFE SETTINGS and will be used in all environments except where specifically overridden.

For environment-specific configuration option overrides:

  • Use an existing environment config in config/environments or create a new one. Bedrock will require any file in the config/environments directory with a filename matching the WP_ENV environment variable. This environment variable can be set in a few ways:
    • in the .env file as described in our installation docs
    • via Trellis config if you're using Trellis
    • or as a last resort, hardcoding it in config/application.php
  • Bedrock comes with development.php and staging.php configs included. If you create an additional environment, configure it with a matching php file in config/environments.

  • The development.php file configures 'WP_DEBUG_DISPLAY', true, so WP_ENV=development, wordpress will display php errors in the browser.

NOTE: The previous Bedrock approach was to require environment configs before the main application, and you can read about why we changed it and how it works here or follow the discussion here. Briefly, Config::define is a static method that overrides the Application (WP) Options with Environment-Specific Options where they are defined, defaulting to the (SAFE, production-standard) Application Options set in config/application.php, and now gives an error when you try to re-define a php GLOBAL, instead of just silently not doing it.

Join over 5,800 subscribers on our newsletter to get the latest Roots updates, along with occasional tips on building better WordPress sites.

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?

“Easily the best WordPress email I get.” Colin OBrien

Follow us on Twitter @rootswp

Ready to checkout?