Skip to content

Instantly share code, notes, and snippets.

@fjarrett
Last active November 15, 2017 06:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjarrett/a3870e0ea120ab985c93 to your computer and use it in GitHub Desktop.
Save fjarrett/a3870e0ea120ab985c93 to your computer and use it in GitHub Desktop.
Replacement wp-config.php file for WP project repos
<?php
/**
* This is a `wp-config.php` replacement file for WP project repositories.
*
* It's purpose is to allow WP configurations such as database credentials,
* auth salts and other constants to be environment-agnostic and live outside
* of version control and outside the `public_html` docroot.
*
* Place your environment-specific `wp-config.php` one level above the docroot
* in a `config` dir.
*/
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
if ( ! file_exists( ABSPATH . '../config/wp-config.php' ) ) {
echo '<pre>Error: No wp-config found!</pre>';
die();
}
require_once ABSPATH . '../config/wp-config.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment