get_home_path

Definition:
function get_home_path() {}

Get the absolute filesystem path to the root of the WordPress installation

Return values

returns:Full filesystem path to the root of the WordPress installation

Source code

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;

}

1414

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: