Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

What is: Absolute Path

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

In WordPress, an absolute path is the complete address of a file or folder within your website’s file system.

The WordPress file system stores all the information for your website, like text and images. Each file and folder has a specific location, identified by its path.

An absolute path starts from the very beginning, which is the root directory where all your WordPress website’s files are stored. Then, it continues to include every folder you need to reach the specific file.

For example, an absolute path for a WordPress plugin file may look like /var/www/html/

This file path starts from the WordPress root directory of the server (/var/www/html/ and includes the directory structure leading to the specific file (wp-content/plugins/my-plugin/my-plugin.php).

What Is Absolute Path in WordPress

What Does Absolute Path Do?

An absolute path acts like a roadmap within a computer’s file system. It’s a term used in operating systems like Linux or Microsoft to refer to the exact location of any file or folder.

In WordPress, absolute paths can reference any file on your website, no matter its location. This could be an image used in a blog post, a CSS stylesheet that controls the website’s design, or a plugin file that adds new functionality.

How Does WordPress Use Absolute Paths?

WordPress uses absolute paths to ensure that resources are correctly loaded from the root of the WordPress installation. Here are some ways WordPress uses absolute paths:

  • Executing core files: WordPress uses a special constant called ABSPATH to find and execute its own files. This ensures that WordPress can always find its own files no matter where you are on the site.
  • Loading WordPress themes and plugins: When WordPress loads a theme or a plugin, it uses absolute paths to find and use its files. This is important for making sure your site works the way you want it to.
  • Linking to media library files: For images and other files in your site’s media library, WordPress creates absolute URLs by default.
  • Including stylesheets and scripts: When WordPress adds stylesheets or scripts to your site, it uses absolute paths to load these resources correctly.


ABSPATH is a constant defined in the wp-config.php file of a WordPress installation. It represents the absolute path to the root directory on the server.

You can learn more about wp-config.php in our beginner’s tutorial on useful WordPress configuration tricks.

To find out your absolute path, you can log in to the WordPress dashboard and go to Tools » Site Health. Then, navigate to the ‘Info’ tab.

Opening Site Health Info in WordPress

Then, scroll down to the WordPress constants section.

There, you will find your absolute path next to ‘ABSPATH.’

Locating ABSPATH in WordPress

Knowing your absolute path can be useful in some cases, like if you want to migrate your WordPress site. It helps you correctly locate and transfer all the necessary files so that your site functions correctly on the new server.

Or you may be encountering issues with a file not loading correctly, and you suspect the path might be wrong. Knowing the absolute path can help you troubleshoot WordPress and verify that the path is correct within your code.

What Is the Difference Between Absolute Path and Relative Path?

Both absolute paths and relative paths are used to find files within a website’s file system. However, they are different in how they specify the location.

An absolute path provides the complete address of a file. It’s like giving a full street address, including the city and state, to find a specific location.

On the other hand, a relative path specifies the location of a file relative to the current location (the file you are currently working on). It’s like giving directions to someone already inside a building, telling them to ‘go up two floors and turn left’ to find a specific office.

Let’s use an example. Say you have an image named example-image.jpg stored in the media library of your WordPress site. The media library is typically located in the wp-content/uploads directory within the WordPress installation.

An absolute path may look like this: /var/www/html/

In contrast, a relative path will look like this: 2023/04/example-image.jpg.

Absolute Paths vs Relative Paths: Which One Is Better for Linking?

WordPress uses absolute paths to refer to its core files and others so that they can be properly loaded. But when it comes to internal linking, many web developers recommend using relative paths instead.

Example of relative internal link

This is because if you move your website to a different server, relative links will still work as long as the folder structure remains the same.

In contrast, absolute URLs would need to be manually updated.

Example of an absolute path URL

With all that in mind, if you are linking to external resources from another website, then you should use absolute URLs to load them properly.

We hope this article helped you learn more about the absolute path in WordPress. You may also want to see our Additional Reading list below for related articles on useful WordPress tips, tricks, and ideas.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!