A basic guide to WordPress file and directory structure

Learn the particulars related to the WordPress file and directory structure, how to access your folders and the various ways you can fix errors with this feature.

wordpress file and directory structure

Need content for your business? Find top writers on WriterAccess!

Your WordPress file and directory structure is essential to getting your website working. Just as your computer needs the right files in the correct places for your programs and features to perform, your site requires the right structure to work as intended.

However, are you familiar with how this structure is supposed to be organized and how to use it effectively?

WordPress is the most popular content management system in the world. It is responsible for powering 34% of all websites on the web while also having a 61% share among CMS solutions.

As it provides a lot of value to those who wish to use their websites to generate effective results, it is also important to learn how it works.

Much of that depends on the correct file and directory structure. Your WordPress website or blog will only work correctly if all the right files are inside the appropriate folders, in the proper order.

Keen to learn more about this? Here is everything you will see in this article:

Download this post by entering your email below

Do not worry, we do not spam.

Understanding the WordPress file and directory structure

Just as the files on your computer make sure that all of its programs work correctly, the contents of your WordPress directory structure are vital to your website. A single missing file or a wrong attribute can take your entire site down and cause all kinds of problems for your WordPress installation.

At the same time, knowing how to navigate the file and directory structure on your WordPress site can also help you fix several issues that might emerge.

For instance, a buggy plugin can lock you out of your admin panel, with the only solution being to delete it from the file system directly. This is also essential knowledge for creating a theme in WordPress.

That is why you must understand how the WordPress file and directory structure work. Learning how to navigate it will allow you to have more control over elements such as WordPress plugins and themes.

In case any of these or perhaps even your WordPress installation itself go through issues, you can effectively fix them.

A typical WordPress file and directory structure looks like this:

Folders

wp-admin

This folder is responsible for powering your WordPress site’s admin tools, such as your dashboard and several key features like enabling connection to your database and managing user permissions.

wp-content

The wp-content folder has two subdirectories: plugins and themes, which store data related to these add-ons on your WordPress installation. Each plugin and theme you install will create a new folder in this structure.

wp-includes

Within the wp-includes folder are all the files necessary to make your website run, such as WordPress functions, those that control your posts, pages, widgets and the other various features.

Files:

  • index.php
  • license.txt
  • readme.html
  • wp-activate.php
  • wp-blog-header.php
  • wp-comments-post.php
  • wp-config-sample.php
  • wp-cron.php
  • wp-links-opml.php
  • wp-load.php
  • wp-login.php
  • wp-mail.php
  • wp-settings.php
  • wp-signup.php
  • wp-trackback.php
  • xmlrpc.php
  • .htaccess
  • wp-config.php

It is recommended to keep the file and directory structure as it is when downloading WordPress from the official website. The zip file already contains all folders and files in the right places, so you just have to extract them all and upload them to your hosting service through FTP.

Accessing WordPress files and directories

You can easily browse and edit your files and folders within your WordPress installation through FTP access. This is an essential feature offered by the hosting service and can usually be found at the user panel or control center, depending on how your interface is organized. If you are in doubt, consult tech support.

FTP access requires entry via a login and password. You also have to specify the correct connection port. This allows you to add files from your computer to your site, or download files from the site locally. You can do that in two ways:

  • a web app offered by your hosting service, which you can usually find in your admin panel;
  • a third-party program such as FileZilla or WinSCP, which are recommended for heavier file operations. 

A FTP directory functions just like the ones you have on your computer. They can be renamed, moved, deleted, and created as well as store all kinds of files. Be careful not to inadvertently edit or erase important WordPress installation files as they are required to keep your website online.

4 WordPress errors and problems solved with FTP access

Having FTP access to your file and directory structure allows you to fix several common errors and problems within WordPress. Knowing how to open your directories can help you regain access to your WordPress site or blog, configure its permissions settings and even enable maintenance protocols.

Below, you will see a list of 4 common WordPress errors and problems that can be fixed with the use of FTP access:

1. Fix database connection errors in WordPress

If you get an Error Establishing a Database Connection in WordPress, the first step you should take is to try to enter your admin panel. In case that shows you ‘an unavailable database error’, then you need to repair that connection.

This task can be performed easily through FTP access. Go to your root WordPress folder and edit the wp-config.php file. Add the following line to the end of the file:

define(‘WP_ALLOW_REPAIR’, true);

After saving and reuploading the wp-config.php file, visit the following URL on your browser:

www.yoursite.com/wp-admin/maint/repair.php

This will open a maintenance utility from WordPress that allows you to repair your databases. Just click the button to begin the process. When you are done, do not forget to edit the wp-config.php file again to remove the line you added.

2. Fix the WordPress Memory Exhausted Error

In case your WordPress website or blog is showing a Memory Exhausted Error, this can be fixed with FTP access and some knowledge of how to change the allowed memory usage for your pages and plugins.

The default memory allocation for WordPress is 64 MB, which is usually enough for most cases. However, there might be situations where you need more.

All of your site’s WordPress functions rely on memory to perform their tasks just like a computer. Also, just like a desktop needs appropriate RAM to run its applications, you need to allocate enough memory for your WordPress site.

To do that, first access your website’s FTP directory and open your WordPress root folder. There, you will need to edit the wp-config.php file. At the last line, paste the following text:

State of Marketing Report 2024

define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

This will set your allocated memory limit to 256 MB, which should be more than enough for the Memory Exhaust Error to resolve itself.

3. Fix the WordPress “White Screen of Death”

Imagine this: you try to access your website, and all that you get is a white, blank screen. Has this ever happened to you? This usually happens whenever there are buggy plugins or WordPress themes active on your site. However, the same problem can occur when you try to open your admin panel.

In these situations, the solution is connecting to your WordPress file and directory structure through FTP access. Go to directories wp-content/themes and wp-content/plugins and rename them. Check whether you are able to open your WordPress admin panel now.

The next step involves narrowing down which plugin or theme might have caused the issue. Go back to your FTP access and rename wp-content/themes and wp-content/plugins back. Then, start renaming each plugin and theme folder inside them while testing your website.

When the error happens again, you will know which plugin or theme was causing the issue. Just remove it from your files to fix the issue.

4. Fix image upload errors in WordPress

In case you are having issues uploading images to your WordPress website or blog, a possible solution involves FTP access. That is because the cause might be that the folder has the wrong permissions set to enable it to receive your image uploads.

To do that, go to your WordPress “wp-content” folder, which is at your root directory. Inside, you will find a folder named “uploads”, which is the one we are looking for. Open the permissions settings for that directory to take a look.

Set the permissions for the “uploads” folder and its subdirectories to 744. While still editing your permissions, toggle the recurse into subdirectories function, which applies the change to all folders inside of it.

Next, you need to set the permissions for the files in your “uploads” folder. For those, you need to set the permissions to 644. Like before, enable recurse into subdirectories.

After you apply all changes, go back to your admin panel and try uploading an image into a post again.

Changing your WordPress file and directory structure

Now that you have learned the most important detail on your WordPress file and directory structure, it is time to know how you can change it. After all, customization at this level can be highly beneficial when applied correctly.

Here are the most useful changes you can do to your WordPress file and directory structure:

Changing the file and folder permissions

As you have seen above, some WordPress problems can be fixed by adjusting the file permissions on your directories. FTP access works through special codes that define what each kind of user is able to do to your files and folders.

In case you are using an FTP desktop application such as FileZilla or WinSCP, this process is more intuitive. You can pick owner, group, and public permissions and get the code automatically.

For example, if you want a file to be readable and writeable only by the owner, the code is 600. 

Increasing security with a directory move

Most possible invaders will assume your important WordPress files will be located at your website’s root directory. Because of that, you should consider moving those directories to another location away from the root.

To do that, just create a new folder at your root directory to serve as the home of your WordPress files. In your admin panel, go to Settings and choose General. At the WordPress Address (URL) field, enter the address that includes your recently created folder name. Click Save Changes.

After that, it is time to move all your WordPress files and folders to the new location. Select all your files and move them to your new folder. Lastly, copy your .htaccess file from inside your new folder and paste it at the root. Do the same thing with the index.php file.

Changing the location of some folders

You can bring some level of customization to your WordPress file and folder structure by changing the names and locations of some directories. However, be warned that it only applies to the following: wp-content, plugins, and uploads.

After doing a change, you must update your wp-config.php file with a line that points to the new location. Here is an example:

define( ‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/newfolder/wp-content’ );

define( ‘WP_CONTENT_URL’, ‘https://your-site.com/newfolder/wp-content’ );

The same applies to your plugins folder:

define( ‘WP_PLUGIN_DIR’, dirname(__FILE__) . ‘/newfolder/wp-content/plugins’ );

define( ‘WP_PLUGIN_URL’, ‘https://your-site.com/newfolder/wp-content/plugins’ );

Lastly, you can rename your uploads folder to whatever you wish. But, before doing that, add the following line to your wp-config.php file above a line that starts with “require_once”:

define( ‘UPLOADS’, ‘wp-content/newname’ );

After that, rename your uploads folder through FTP access—in this example, we used “newname”.

Your WordPress file structure is essential for your website to stay online and work correctly. Any issues that arise can directly affect your ability to generate results with your website, such as driving sales and growing your brand’s presence. Therefore, it is important to know how to work with these files and folders.

Learn more about how to improve your strategy further. Download our free ebook: “WordPress Guide for Corporate Blogs!”

WordPress Guide for Corporate Blogs - Promotional Banner
Share
facebook
linkedin
twitter
mail

Human Crafted Content

Find top content freelancers on WriterAccess.

Human Crafted Content

Find top content freelancers on WriterAccess.

Subscribe to our blog

Sign up to receive Rock Content blog posts

Rock Content WriterAccess - Start a Free Trial

Order badass content with WriterAccess. Just as we do.

Find +15,000 skilled freelance writers, editors, content strategists, translators, designers and more for hire.

Want to receive more brilliant content like this for free?

Sign up to receive our content by email and be a member of the Rock Content Community!

Talk to an expert and enhance your company’s marketing results.

Rock Content offers solutions for producing high-quality content, increasing organic traffic, building interactive experiences, and improving conversions that will transform the outcomes of your company or agency. Let’s talk.