WordPress Files and Folder Structure
When you open the WordPress folder, you see many files and three main folders. Knowing them helps you to find things, fix problems and keep your site safe.
The root folder
Terminal output
$ ls -a
.
..
.htaccess
index.php
license.txt
readme.html
wp-activate.php
wp-admin
wp-blog-header.php
wp-comments-post.php
wp-config-sample.php
wp-config.php
wp-content
wp-cron.php
wp-includes
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
What each part does
| Item | What it is |
|---|---|
| wp-admin/ | The code of the dashboard. Never edit it |
| wp-includes/ | The core libraries and functions. Never edit it |
| wp-content/ | Your own content: themes, plugins and uploads. This is your working folder |
| wp-config.php | Main settings: database connection, security keys and debug mode |
| wp-load.php, wp-settings.php | Start the WordPress environment on every request |
| wp-login.php | The login page |
| wp-cron.php | Runs the scheduled tasks |
| xmlrpc.php | An old remote access file. Most sites do not need it, so many people disable it |
| index.php | The entry point. Every page request goes through it |
| .htaccess | Server rules for pretty permalinks (Apache) |
| readme.html, license.txt | Information files. You can delete readme.html to hide the version |
Inside wp-content
Terminal output
$ ls wp-content
index.php
plugins
themes
uploads
$ ls wp-content/plugins
akismet
hello.php
index.php
themes/: all installed themes.plugins/: all installed plugins.uploads/: media files you upload.mu-plugins/: “must use” plugins. They load automatically and cannot be turned off from the dashboard. Create it yourself if needed.languages/: translation files.upgrade/,cache/: temporary files, created when needed.
Which files are safe to edit?
| Folder or file | Edit? |
|---|---|
| wp-admin, wp-includes | No. Updates will overwrite your changes |
| wp-config.php | Yes, with care, and take a backup first |
| Active theme | Only in a child theme, or your own theme |
| Plugins from others | No. Use settings or hooks instead |
| wp-content/uploads | Only to upload or clean files |
Note:
The core folders are replaced on every WordPress update. Always keep your own code in a theme, a child theme or your own plugin. Next: The wp-config.php File.
Congratulations! Chapter Finished. Learn more about the similar topics:
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |