| 1 | Function get_home_path() from wp-admin/includes/file.php |
|---|
| 2 | |
|---|
| 3 | function get_home_path() { |
|---|
| 4 | $home = get_option( 'home' ); |
|---|
| 5 | $siteurl = get_option( 'siteurl' ); |
|---|
| 6 | if ( $home != '' && $home != $siteurl ) { |
|---|
| 7 | $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ |
|---|
| 8 | $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); |
|---|
| 9 | |
|---|
| 10 | $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); |
|---|
| 11 | echo "HOME_PATH0 = $home_path;<br />"; |
|---|
| 12 | $home_path = trailingslashit( $home_path ); |
|---|
| 13 | echo "HOME_PATH1 = $home_path;<br />WPPATHREL2H: $wp_path_rel_to_home<br />POS: $pos<br /><br />"; |
|---|
| 14 | } else { |
|---|
| 15 | $home_path = ABSPATH; |
|---|
| 16 | echo "HOME_PATH2 = $home_path; <br />ABS: ".ABSPATH."<br />"; |
|---|
| 17 | } |
|---|
| 18 | echo "HOME: $home<br />SITEURL: $siteurl<br />HOME_PATH3: $home_path<br />"; |
|---|
| 19 | //exit; |
|---|
| 20 | return $home_path; |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | Output when WordPress address (URL) and Blog address (URL) are changed at teh same time to a different value (both the same). |
|---|
| 24 | |
|---|
| 25 | HOME_PATH0 = ; |
|---|
| 26 | HOME_PATH1 = /; |
|---|
| 27 | WPPATHREL2H: http://site.com |
|---|
| 28 | POS: |
|---|
| 29 | |
|---|
| 30 | HOME: http://127.0.0.5 |
|---|
| 31 | SITEURL: http://site.com |
|---|
| 32 | HOME_PATH3: / |
|---|
| 33 | HOME_PATH0 = ; |
|---|
| 34 | HOME_PATH1 = /; |
|---|
| 35 | WPPATHREL2H: http://site.com |
|---|
| 36 | POS: |
|---|
| 37 | |
|---|
| 38 | HOME: http://127.0.0.5 |
|---|
| 39 | SITEURL: http://site.com |
|---|
| 40 | HOME_PATH3: / |
|---|
| 41 | HOME_PATH2 = C:\websites\site/; |
|---|
| 42 | ABS: C:\websites\site/ |
|---|
| 43 | HOME: http://site.com |
|---|
| 44 | SITEURL: http://site.com |
|---|
| 45 | HOME_PATH3: C:\websites\site/ |
|---|
| 46 | HOME_PATH2 = C:\websites\site/; |
|---|
| 47 | ABS: C:\websites\site/ |
|---|
| 48 | HOME: http://site.com |
|---|
| 49 | SITEURL: http://site.com |
|---|
| 50 | HOME_PATH3: C:\websites\site/ |
|---|