-
-
Save wpsmithtwc/b31f99fb8a0704572454962bbe6b99f6 to your computer and use it in GitHub Desktop.
`wp-config.php` file to sit above a pristine WordPress directory, whereby the site can symlink their WP directory to a common one, and this file will make sure their `wp-config.php` is the one that gets called. Untested in production. Just an idea right now.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = str_replace( $_SERVER['DOCUMENT_ROOT'], '', dirname( $_SERVER['SCRIPT_FILENAME'] ) ); | |
$path_parts = explode( '/', $path ); | |
while ( count( $path_parts ) > 0 ) { | |
$path = $_SERVER['DOCUMENT_ROOT'] . implode( '/', $path_parts ) . '/wp-config.php'; | |
if ( file_exists( $path ) ) { | |
include( $path ); | |
break; | |
} else { | |
array_pop( $path_parts ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment