WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get home path

Description

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

This is a backend function.

Usage

 <?php $path get_home_path(); ?> 

Parameters

Return Value

(string) 
Full filesystem path to the root of the WordPress installation. If you install wordpress in subfolder, it will NOT show subfolder location. You can use the constant ABSPATH if you need the full path including the sub-directory.

Examples

Default Usage

$path = get_home_path();
print "Path: ".$path; // Return "Path: /var/www/htdocs/"

Change Log

  • 3.5.0: Improve path sanitization in Windows systems and make checks against site_url() and home_url() case-insensitive.
  • Since: 1.5.0

Source File

get_home_path() is located in wp-admin/includes/file.php

Related