Before start coding for WordPress, it is important to understand the WordPress file and directory structure. WordPress works under the Open Source GPLv2 license, giving us the opportunity to have the full source code of the software, this is something convenient, because, we can use the WordPress code as a learning source when we are in troubles implementing, creating or just modifying themes, plugins, widgets, etc.
The WordPress file and directory structure
At the WordPress root directory, there are three folders, wp-admin, wp-content and wp-includes, two of them (wp-includes and wp-admin) are considered CORE FOLDERS, so, every file inside these folders are core files, and you should not modify any of them. Wp-Admin holds the site administrator template files and admin core functionality. Inside wp-includes is everything else to keep WordPress running; rest-API services, cron services, plugin installation, activate, deactivate and remove services, widgets, filters, constants, template, user role, cache handlers, database management, and much more!
The wp-content folder contains all files and folders for WordPress content presentation and handling. They are plugins, widgets, themes and uploaded files like pictures, audio, videos, pdfs, etc. We will be working a lot inside this folder when we learn how to create, modify and remove a plugin, widget or template.
Also, at the root directory of WordPress, you can find several files that are considered core files too, but, you are allowed to modify two of them.
Do not modify:
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
The .htaccess and wp-config.php files are free to be modified, but, you have to know what you are doing, because, they are critical files of WordPress and you can break your site if you do something wrong.
The wp-config.php is the most important configuration file of WordPress, in this file, you set the database information, salt security codes, turn debugger service on or off, the database prefix, etc. We will talk about this file in the next article.
And the .htaccess is a server configuration file; it is used to handle the WordPress redirects and engineering the “permalinks” (We will talk about this in another article. They are friendly URLs for better SEO and readability).
In the WordPress file and directory structure, there many core files and folders that are overridden when WordPress updates (except wp-config.php and .htaccess), so, you should not modify any of these files because it drives to an unstable WordPress system. Also, third-party plugins, widgets, and themes are considered “sub-core files,” so, you should not modify them, because, when you update any of these components every modification is overridden too.
If you want to learn more about the WordPress file and directory structure, you can go to WordPress files section in the codex.