Fix error missing wp-load.php

Fix for missing wp-load.php when the script went up the directory to look for wp-load.php.

Refer: ultimatemember#280
This commit is contained in:
Abdus Fauzi
2017-07-01 21:53:05 +08:00
committed by GitHub
parent 66b9a5e9e3
commit 2a34019725
+14 -2
View File
@@ -1,12 +1,24 @@
<?php
$i = 0;
$dirname = dirname( __FILE__ );
do {
$dirname = dirname( $dirname );
$wp_config = "{$dirname}/wp-config.php";
$wp_load = "{$dirname}/wp-load.php";
}
while( ++$i < 10 && !file_exists( $wp_load ) );
while( !file_exists( $wp_config ) );
if ( !file_exists( $wp_load ) ) {
$dirs = glob( $dirname . '/*' , GLOB_ONLYDIR );
foreach ( $dirs as $key => $value ) {
$wp_load = "{$value}/wp-load.php";
if ( file_exists( $wp_load ) ) {
break;
}
}
}
require_once( $wp_load );
global $ultimatemember;