It is checked for the wp-config.php
. This can of course be changed to other wordpress core files.
function find_wordpress_base_path() {
$dir = dirname(__FILE__);
while( $dir = realpath("$dir/..") ) {
//it is possible to check for other files here
if( file_exists($dir."/wp-config.php") ) {
return $dir;
}
}
return null;
}