Leave a Reply

To leave a comment, please Login or Register

Comments (2)

Balvinder Singh Selected

Balvinder Singh

2 years ago
There are two type of file paths
1. relative
2. absolute
relative is when we know path of some file and need to look along nearby path , like var/www/index.php var/www/options.php both are in same folder, so we can do ../options.php to use in index.php as a relative path.

where as var/www/options.php is we add this path then it is an absolute path.

Absolute path in case for Wordpress is the exact path from public folder or / in Linux

so, if we have our WordPress under folder /html , so we can access other files by adding path
/html/folder/file or folder/file with exact folder/file name

Manish Singh Bisht Selected

Manish Singh Bisht

4 months ago
In WordPress, an absolute path refers to the full, complete file path that points to a specific file or directory on a server. It starts from the root directory of the file system and includes the entire directory structure leading up to the file or directory.

An absolute path is different from a relative path, which refers to the location of a file or directory in relation to the current file or directory.

For example, an absolute path to a file called "image.jpg" located in the "wp-content/uploads" directory on a WordPress site might look like this:

In WordPress, absolute paths are often used when working with the file system and when interacting with the server. For example, when working with plugin or theme files, you may need to use an absolute path to include a file or reference a directory. They are also useful when using some PHP functions such as realpath(), file_exists(), is_file() or is_dir() as well as for working with the wp_filesystem API.