Directory

Understand where your files live | Learn WordPress

Understand where your files live

Extra resources

Transcript

In this lesson, we will answer the question, “Where is your WordPress site stored, or where do your files live?”

Learning objectives

  • Access your server via FTP
  • Gain a basic understanding of the file structure
  • Learn how to download and upload files
  • Get to know WordPress’ main configuration file

Your hosting provider’s server is a computer that you can access to browse and interact with the files that make up your site. There are several ways to do it, the most straightforward is via FTP. FTP stands for File Transfer Protocol: the standard way to transfer files between computers, such as your device and your hosting company’s server.

You can use a standalone FTP app, like FileZilla or Cyberduck, which enables more advanced options, but for now, let’s explore your server using cPanel’s File Manager, a common browser-based solution supported by most hosting providers. From your hosting dashboard, open cPanel and select Files > File Manager.

The file structure

Welcome to your corner of the cloud. If you’ve ever browsed around the file system on your local device, this shouldn’t look too foreign: On the left, there’s the list of directories, and on the right are the files and subdirectories.

Click on the public_html directory to open it. This is most likely the root of your WordPress site and contains all the files related to WordPress Core, as well as your themes, plugins, and any assets you uploaded, such as fonts, images, and other media.

Take a moment to browse around, and familiarize yourself with the file structure, user interface, and different file extensions. Feeling curious? Select a file and click the View button on the top menu to inspect its contents.

Explore the wp-content directory

All the non-Core, user-controlled WordPress content is stored in the wp-content directory. This is where the plugins, themes, languages, and uploads are, each with its respective files and subdirectories. You may see other directories, including upgrade (used by WordPress during upgrades) and others used by plugins to store additional files.

Download files

If you want to manually back up your site, wp-content is the directory you need to download.

To do that from the cPanel File Manager, select the directory and click the Compress button on the top menu. Note where the ZIP file would be saved (the default is one directory up, so in this case, it would probably be public_html. You can type another path if you wish), and click Compress Files. 

Now navigate to the relevant directory, select the zipped file, and click the Download button on the top menu. Once the file is successfully downloaded to your device, you can delete it from the server (select it and click the Delete button on the top menu).

Upload files

Sometimes you want to upload plugins or themes manually, or otherwise troubleshoot your site. Doing that via the admin dashboard is obviously easier, but isn’t always possible.

To upload a file via the cPanel File Manager, drag it from your device into the relevant directory on the server, or navigate to the desired location and click the Upload button on the top menu.

Similar to the scenario described earlier, in the download section, if you want to upload a directory—say, an unzipped theme or plugin—you would need to first compress it on your device. Then upload the zipped file to the server. To unzip the file, select it and click the Extract button on the top menu.

WordPress configuration file

Let’s explore wp-config.php, a key file, which contains your website’s configuration. WordPress creates the file during the setup process based on the information you provide in the course of the installation.

Interacting with wp-config.php is essential when troubleshooting or setting up Multisite – a network of WordPress sites. We’ll cover both topics in the following lessons, so it’s a good idea to get to know this file. If you plan to enable Multisite, you would need access to a file named .htaccess that’s located in the public_html directory.

If you don’t see it, click the Settings button in the top-right corner to open the Preferences popup window, select Show Hidden Files (dotfiles), and click Save.

Select wp-config.php from the list of files and click the View button on the top menu.

When you scroll down, you’ll notice several sections comprised of comments in plain English—these are the explanations enclosed in asterisks (*)—followed by PHP functions that determine all sorts of settings responsible for how your site functions. They specify things like database settings, authentication keys, and debugging mode status.

For example, the line define( ‘DB_NAME’, ‘MY_DATABASE_NAME’ ); tells WordPress the name of your database, and define( ‘DB_USER’, ‘MY_DATABASE_USERNAME’ ); specifies the username associated with it.

Depending on your site’s configuration, you may also see additional settings, such as

  • define( ‘EMPTY_TRASH_DAYS’, NUMBER ); to set the number of days before WordPress permanently deletes trashed content.
  • define( ‘DISALLOW_FILE_EDIT’, true ); to disable the plugin or theme file editor and block access to these areas in the Admin dashboard.
  • define( ‘WP_AUTO_UPDATE_CORE’, false ); to prevent automatic updates of WordPress Core. There are dozens of other options.

For the complete list, refer to the Editing wp-config.php page in the WordPress Developer Resources.

Conclusion

Even if you decide to never interact with your site’s contents outside the WordPress Admin dashboard, understanding where it’s stored, and how to access it deepens your understanding of how the web works. Hopefully, demystifying “the cloud” will boost your confidence, either when you work on your site or reach out to others for help.

To learn more, visit the Beginner WordPress Developer Learning Pathway, specifically the lesson dedicated to The WordPress file structure.

Suggestions

Found a typo, grammar error or outdated screenshot? Contact us.