WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/get home path

Contents

Description

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

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 show subfolder location

Examples

Default Usage

$path = get_home_path();
print "Path: ".$path; // Return "Path: /var/www/htdocs/" or "Path: /var/www/htdocs/wordpress/" if it is subfolder

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