Created
February 28, 2012 15:52
-
-
Save itspluxstahre/1933288 to your computer and use it in GitHub Desktop.
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 | |
/// HACK TO WORKAROUND A BUG IN WORDPRESS | |
function yogasutra_fix_get_home_path() { | |
if ( !function_exists('get_home_path') && !is_admin()) : | |
function get_home_path() { | |
$home = get_option( 'home' ); | |
$siteurl = get_option( 'siteurl' ); | |
if ( $home != '' && $home != $siteurl ) { | |
$wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ | |
$pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); | |
$home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); | |
$home_path = trailingslashit( $home_path ); | |
} else { | |
$home_path = ABSPATH; | |
} | |
return $home_path; | |
} | |
endif; | |
} | |
add_action('init', 'yogasutra_fix_get_home_path'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment