keepcalculator

06 Numbers and Powers

WordPress Files & Folders: A Practical Guide

Card No. 06·27062 · Updated · Standard formula, shown below

This guide explains the standard WordPress file and folder structure, what each directory and key file does, and how to use that knowledge for maintenance, troubleshooting, and customization. You’ll learn the purpose of core files, themes, plugins, uploads, and configuration files, plus common tasks like fixing permission errors and safely editing files.

Why the File Structure Matters

WordPress is a PHP-based content management system. When you install it, a set of files and folders is placed on your web server. Understanding this layout is not just academic: it helps you:

  • Identify where to add custom code (child theme functions.php) without breaking updates.
  • Find and fix errors like the “white screen of death” or file permission warnings.
  • Back up only the essential parts, or move a site to a new host.
  • Understand what a security plugin scans or what an attacker might target.

You don’t need to memorize every file, but knowing the main folders and the few critical files will save you time and prevent costly mistakes.

The Top-Level Structure

At the root of your WordPress installation (where wp-config.php lives), you’ll usually see these folders and files:

  • wp-admin/ – Contains the dashboard and admin pages. You rarely edit anything here.
  • wp-includes/ – The core library of functions, classes, and APIs. Never edit these files; changes are overwritten on updates.
  • wp-content/ – The folder you’ll interact with most: themes, plugins, and uploads live here.
  • wp-config.php – Not a folder, but the most important file. It holds database connection settings, security keys, and table prefix.
  • .htaccess (on Apache) – Controls URL rewriting for permalinks, caching rules, and security directives.
  • index.php – A silent loader that just includes the wp-blog-header.php file.
  • wp-load.php – Loads the WordPress environment; often used in custom scripts.
  • wp-settings.php – Sets up constants and loads the core files.

Inside wp-content

The wp-content folder is your site’s user-generated and third-party code. It contains:

  • themes/ – Each theme has its own folder. The active theme determines how your site looks. Always use a child theme if you modify code.
  • plugins/ – Each plugin gets its own folder. Plugins add features; they can be deactivated by renaming the folder via FTP if one causes a fatal error.
  • uploads/ – All media files (images, PDFs, videos) are stored here, organized by year and month (e.g., uploads/2025/07/). This folder is usually the largest and must be backed up.
  • upgrade/ – A temporary folder used during core updates. It should be empty after a successful update.
  • index.php – A silent protection file; it does nothing but keeps directory listing off.

You may also see cache/ (if a caching plugin creates it), debug.log (if WP_DEBUG_LOG is enabled), or backup-db/ (from some backup plugins).

Key Configuration Files and What They Do

Two files are essential for every WordPress site:

  • wp-config.php – Contains database name, user, password, host, and the $table_prefix. It also defines constants like WP_DEBUG, WP_HOME, and WP_SITEURL. You can add custom constants here, but always back up the file first.
  • .htaccess – On Apache servers, this file handles permalink structures (via mod_rewrite), hotlink protection, and sometimes security headers. If permalinks break, this file is often missing or not writable.

Other files like wp-cron.php (runs scheduled tasks) and xmlrpc.php (legacy remote access) are less commonly edited, but you should know they exist.

Common File and Folder Issues and Fixes

Here are the most frequent problems users run into, and how to solve them:

  • “FTP access required” or “Unable to write to wp-content” – Permission issue. Set folder permissions to 755 and files to 644. Never use 777 unless absolutely necessary, and only temporarily.
  • White screen of death – Often caused by a fatal PHP error in a theme or plugin. Access your site via FTP, rename the plugins folder to plugins_old (or rename individual plugin folders), then reload. If it fixes, rename back and activate plugins one by one.
  • Uploads not showing or missing images – Check the uploads folder exists and is writable. If you moved servers, the wp-content/uploads path might have changed; update the option in Settings > Media.
  • Permalinks 404 errors – Go to Settings > Permalinks and click “Save Changes” to regenerate the .htaccess rules. If that fails, check that .htaccess is writable or add the default rules manually.
  • Cannot edit files via dashboard – The editor is disabled by default in newer versions. You can still edit via FTP or a file manager in your hosting panel.

How to Edit Files Safely

Editing core files is almost never a good idea. Instead, follow these practices:

  1. Always create a backup of the file you’re changing, either by downloading it or copying it to .bak.
  2. Use a child theme for any theme modifications. Put custom functions in functions.php of the child theme, not the parent.
  3. For plugin customizations, consider using a code snippets plugin, but be aware that plugin updates may overwrite changes.
  4. If you must edit wp-config.php, use a plain text editor (like Notepad++ or VS Code) to avoid invisible characters.
  5. After editing, test your site immediately. If you get a syntax error, restore the backup.

Backup and Security Considerations

Your file structure directly affects backups and security:

  • Backup at minimum the wp-content folder (especially uploads, themes, plugins) and the wp-config.php file. The database is separate and must be backed up too.
  • Keep core files updated – Updates replace files in wp-admin and wp-includes, but they don’t touch your wp-content folder, so your media and customizations survive.
  • Protect sensitive files – Ensure wp-config.php is not readable by the public. Most hosts block it, but you can add a rule in .htaccess or move it one level above the web root.
  • Remove unused themes and plugins – They can be attack vectors, even if inactive. Delete them from the file system via FTP.

Frequently Asked Questions

What is the difference between wp-admin and wp-includes?

wp-admin contains the files that render the admin dashboard (like the login page and the post editor). wp-includes contains the core PHP libraries and functions that power both the front and back end. You should never edit either; they are managed by WordPress core updates.

Why is my uploads folder so large?

The uploads folder holds every image, PDF, video, and other media you upload. It’s organized by year and month, and it grows quickly. It’s often the main reason your backup is big. You can compress images or move older files to cloud storage, but always keep a backup.

Can I rename the wp-content folder?

Yes, it’s possible but not recommended. You would need to change the WP_CONTENT_DIR and WP_CONTENT_URL constants in wp-config.php. However, many plugins and themes assume the default path, so you may break things. Only do this if you’re experienced and willing to test thoroughly.

How do I fix a broken site after editing functions.php?

If you get a fatal error, access your site via FTP or file manager and open the theme’s functions.php file. Look for a syntax error (often a missing semicolon or bracket). If you can’t fix it, upload a backup copy. If you can’t access the file, rename the theme folder to force WordPress to fall back to a default theme.

What is the .htaccess file and why is it important?

.htaccess is a configuration file for Apache servers. WordPress uses it to create pretty permalinks, and many caching and security plugins add rules to it. If you lose it, your permalinks may break. You can regenerate it by visiting Settings > Permalinks and saving.

Should I use 777 permissions on any folder?

No, 777 means anyone can read, write, and execute files, which is a security risk. Use 755 for folders and 644 for files. If you need to let WordPress write, try 775 or 750 first, and only use 777 temporarily and then revert.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →