Learn about the WordPress programming system and its basic files

There is no doubt that dealing with WordPress as a content management system (CMS) is easy for non-specialists, as anyone can design and create their own WordPress website with ease and without the need to delve into the details of complex WordPress programming. Perhaps this is what has earned the WordPress system its great popularity.

However, after a period of using the WordPress system, you may want to develop your technical knowledge about it, as there are hundreds of files that form the basic structure of your WordPress site, and each of them has a specific purpose or task in the WordPress system, and they work in an integrated manner to communicate commands and provide content to the end user. .

Knowing how to program WordPress helps you better understand the structure of your site, learn more about the basic programming files that work behind the scenes and operate your website, and know the role of each file.

In this article, we will introduce you to the most important files and folders in the WordPress system that help you understand the components and elements of your site in a more professional manner, enable you to manage and develop it successfully, and also make it easier for you to modify and maintain it.

The importance of knowing the WordPress code files

If you want to be a developer, website designer, or just a tech-savvy WordPress website owner, it will be important for you to learn about the structure of WordPress files, and to know the file and folder structure that works behind the scenes.

Understanding the internal software structure of WordPress as a content management system will help you understand the way this system works, and will facilitate the task of creating, developing, modifying and maintaining websites in a more professional manner. It will also facilitate the process of future management of these sites and will enable you to contribute to developing the infrastructure of the system. WordPress itself.

However, if you are a website owner who is not interested in the precise technical aspects of your site, and you entrust the responsibility of developing and maintaining the site to a specialized developer or hosting company, in this case you do not need to know the detailed structure of all WordPress files and folders. It may be sufficient for you to view a small number of files necessary to help you with some administrative tasks, such as uploading files to the site or protecting the site’s databases.

The main benefits of learning about WordPress programming

  1. Knowing how to program WordPress helps you, as a developer, have a strong knowledge of how the WordPress platform works and access customer site files and solve any programming problems in them.
  2. Knowing the WordPress file structure as a WordPress user will help you solve website issues yourself instead of communicating with developers or hosting companies. Troubleshooting WordPress will be much easier when you are familiar with the file structure in WordPress and know how to access them.
  3. You will know where and how files, templates, and plugins are stored, giving you other options and ways to upload and download WordPress files to your site, and the ability to detect problems that occur in one of the plugins or templates.
  4. You’ll better understand how data is stored on your site, how to upload files and media into your WordPress site in various ways, and you’ll learn how to share and protect it when needed.
  5. You’ll be able to edit your site’s language files, and learn how to make your site multilingual more easily.
  6. When you are well informed about your site’s programming, you will be able to make simple modifications to it without causing the site to crash.
  7. You will be able to create a backup of important files for your website.

How to access WordPress code files?

The core WordPress files are located on the remote server or the local server . There are several ways in which you can access these essential files.

1- Access files locally

You can see these files simply by downloading the WordPress zip file to your computer and unzipping it to see the full list of these files.

2- Access files through an FTP client

 You can access these files on your direct website on the hosting server through an FTP or sFTP client program to connect to your WordPress server, such as the Filezilla program, which allows you to connect to your site server using the credentials provided to you by the hosting company.

3- Access files through the hosting control panel.

You can access your website files through the hosting panel provided by the hosting company. For example, if you use the cPanel hosting control panel, you can view the structure of your WordPress site through the File Manager.

WordPress programming components

First, you must know that a website in general is nothing but a set of software files stored on the hosting server that interact with each other to form your site.

Your browser receives the content created with these files and displays it on the browser. Knowing these files, their mission, and how to access the correct file is important if you want to understand your site in depth.

For sites designed using the WordPress system, the site will mainly consist of four basic elements that work together to form your final site: (the basic WordPress files, or what is known as the WordPress core, the site database, template files, and plugin files).

1-WordPress Core files:

They represent all the basic files required for the WordPress system to work. When you download a version of WordPress in a zip file from the official website , you are actually downloading the WordPress kernel.

These files are what enable you to access the WordPress website control panel and manage your site users, add tags and categories, add and edit articles and pages for your site, upload media, manage comments, and much more.

The WordPress core also automatically includes some default themes and plugins that are installed on the site. But it’s not actually part of the WordPress core. A WordPress website needs a default template and some basic plugins in order to build and display your website correctly.

The core files and folders located directly in your site’s root directory are WordPress kernel files. It is responsible for running your WordPress site, and it is not recommended that you edit these files directly because any automatic update to WordPress will make you lose these modifications that you have made.

These files are designed to work without the need to make customizations through them, and it is better to rely on making modifications to basic WordPress functions through files in plugins or templates.

However, if you modify something in your site-wide core files, always avoid changing any of the code unless you have a thorough understanding of exactly what you are doing. Don’t forget to create a backup copy of your website before making any changes to the core WordPress core files so that your site does not crash.

How do I contribute to programming and developing the WordPress platform?

There is a large group of developers around the world who contribute to programming WordPress and developing its basic core. If you are a WordPress developer and you want to contribute to the development of the WordPress platform. You can check the next page  for more information.

If you want to test beta versions of the WordPress core, you can install the WordPress Beta Tester plugin , which upgrades your site to the latest beta version of WordPress to test it and send any feedback about it to the development community.

Read more: How to become a WordPress developer? What skills are required?

2-WordPress database

Without a database, your WordPress site cannot function. When you install a new WordPress site, you must create a MySQL database for this site.

Although the WordPress database is a core component of your WordPress site, it is separate from the core WordPress core files. It stores all the information required for your site to function in addition to saving the changes you or your visitors make to the site.

 Creating a database for your site depends on the hosting used. In some hosts, this step is done on your behalf. Therefore, you must know the type of control panel that your website’s hosting server uses, for example, is it cPanel, Plesk, or something else, and know how to create a database through it.

For example, you can create the database and access it in the cPanel control panel by using phpMyAdmin from within your hosting account.

Almost everything on your site is logged within its database. So some basic familiarity with WordPress database will help you understand it more efficiently.

Here is some of the data stored in the WordPress database:

  • Articles, pages and other types of content.
  • Organizational information on the site such as classifications and tags.
  • Site settings.
  • Information about plugins and themes.
  • User data
  • Comments
  • Profile data

This information is organized within the database in the form of a group of tables linked together. For example, comments are stored in the WordPress database within a table designated for comments, wp_comments , and articles are stored within a folder designated for publications, wp_posts .

The names of the tables in the database express the content that they usually store, and each table consists of different fields that define the information accurately. For example, the wp_comments table contains comment_ID, comment_post_ID, comment_author, and other fields organized in separate columns.

The WordPress database is dynamic, which means you can add, edit, and delete information within it if you have access to it.

To modify any data in your site’s database, you must log in using your database username and password. But be careful before you modify anything in the database because you may crash your site, so it is necessary to take a backup copy to restore it if something goes wrong.

read more:

Explaining WordPress databases and making the most important modifications WordPress database

Solution to the problem: Error Establishing a Database Connection

3- Template files  

The themes directory is located inside the  wp-content directory in the site’s root folder. This directory contains all the templates uploaded to your website and each subfolder within this directory represents a complete standalone template.

Each template has specific instructions embedded in its code that define the values ​​of variables that determine how your website will appear, and with them you can include many template-specific features and add-ons.

 Customizing the appearance of your WordPress site is primarily done by modifying the template files. You can change the colors used on your site, add and edit the images used, you can also the template , change the fonts used on the site, and much more by directly editing its files instead of relying on the template customization interface.

Of course, modifying these files requires basic knowledge of CSS, HTML , JavaScript , and the jquery library , as well as the PHP language and the basic structure of template files and their hierarchy .

It is of course necessary to create a backup copy of your WordPress site before making any direct changes to the template codes, as the backup copy helps you restore the original files in the event that anything goes wrong.

read more:

How to add PHP code to your WordPress site without modifying the source code

Explaining adding JavaScript code to your WordPress site in the easiest way

4- External add-on files

WordPress plugins help you extend the features and functionality of your site. All plugins that you download and install on your site are stored in the plugins folder located in the wp-content folder of your site’s root folder.

 But some plugins sometimes become part of the WordPress core. For example, the Gutenberg editor was initially an external plugin and then was integrated into the WordPress core since the fifth version of WordPress due to its great popularity, replacing the classic editor and helping WordPress developers build their pages and posts easily.

Read more: How to restore the Classic editor in WordPress

You’re not supposed to edit plugin files directly on your site unless you’re developing a custom plugin just for your WordPress site.

 The best way to add custom code to your WordPress site is by adding it to the file called functions.php for your site template, or creating a child template from this template and modifying the functions.php file for the child template.

In the following paragraphs, we will focus on the basic WordPress core files and review the most important of these folders and files necessary to make your site work.

The most important WordPress core folders:

There are several important folders in the WordPress core. Below we explain the three main folders located at the top level of the WordPress folder:  

1-The wp-admin folder

The wp-admin folder located within the site’s root folder contains most of the files that run the WordPress Admin Dashboard.

 You will not have a good user experience when managing your website if you do not have the wp-admin folder and the files inside it.

Here are the most important files contained in the wp-admin folder:

  • Admin.php file: This file controls all the functions in the site’s control panel, verifies the validity of user data, and enables you to block users who should not have access to certain parts of the control panel. It is responsible for enabling a number of important features for your site such as loading the control panel and connecting to the database
  • The file users.php provides an interface for the admin to manage users, taking into account which users have admin access and which do not.
  • The file network.php enables the multi-site feature (WordPress Network of Sites) that allows running and managing multiple WordPress websites or blogs from a single WordPress installation.
  • The update.php file  is a file that provides administrators with the ability to update WordPress themes and plugins.

 2- The wp-content folder

The wp-content folder contains any items that you upload or add to your website as an administrator or user.

The themes subfolder within this folder is used to store templates, and the plugins folder stores external plugins installed on your site. The uploads folder stores all the photos, videos, and other media that you add to the site.

This folder also contains the languages ​​folder, and this folder stores language files when running a WordPress site in a language other than English.

note:

Language files are also included within templates or plugins folders to make them available in other languages, making it easier for you to translate the front-end and back-ends of these themes or plugins.

3-The wp- includes.folder

The wp-includes folder includes all other files that are not related to the core or basic structure of WordPress and that help the rest of the files run your WordPress site properly.

You can think of the wp-include folder as a toolbox. So that other essential folders and files like wp-content and wp-admin are the workers and leaders who access the wp-include toolbox whenever it needs to do something.

For example, if the wp-content folder wants to create elements from a theme or plugin, it first needs to consult the wp-includes folder to make sure the elements are grouped in the correct way for WordPress.

This folder provides the general functionality needed for the WordPress REST API . That is, files in other folders use what is inside the wp-includes folder as resources to complete their own tasks.

 This file contains more than 200 individual files at the top level of the folder. This large number of files makes the size of this folder large, and may pose security risks to your site. Therefore, it is necessary to secure protection for your WordPress site so that one of these files is not exploited as a security vulnerability that threatens your site. .

read more:

How to check your site for malicious software and codes and the most important tips to secure it completely

Secure and protect WordPress websites from all vulnerabilities Comprehensive guide

6 tips to protect WordPress sites – complete protection from hackers

The most important WordPress Core files:

The main folder of the WordPress site contains many files and folders that cannot, of course, be covered in one article, but in this paragraph we will focus on the most important of these files.

In this paragraph, we will explain the most important files inside the WordPress core. These important basic files are included with every installation of WordPress and are located in the root directory of your site when installing WordPress on the hosting server.

functions.php file

The functions.php file for the WordPress core is located inside the wp-includes folder. It is one of the basic and important WordPress files for the website.

With this file you can add custom functionality to your site, and you can also use this file to call predefined functionality that you want to implement on your own site.

It is necessary to know the function.php file in-depth because developers and website owners often use this file to change or add features to websites. The functions.php file acts as a plugin, calling functions already implemented in your files to produce something new.

Do not confuse this file with the file of the same name located in the template folder, which provides you with the ability to add additional functionality and features to the template installed on your site, which works independently of the WordPress core file of the same name.

The theme’s functions.php file runs as part of the active theme that contains this file and stops when this template is deactivated, while the functions.php file for the WordPress core is always running on your site.  

Read more: What is a functions.php file in WordPress? What is its importance? How do you edit it?

wp-config.php file

 The wp-config.php file is essential for WordPress users because it controls all the basic settings of your WordPress site. You may need to edit this file to modify certain configuration settings.

This file contains the information necessary to run your WordPress site, including settings for connecting to a database, the prefix used to name database tables, modifying available memory , security keys that secure the cookie information that WordPress uses to log in, and other settings. Essential to your site.

You can also enable WordPress Debug Mode through this file, which makes it one of the important files for troubleshooting your site.

The most important things that you need to modify through the wp-config.php file:

  • Modifying the entire file system, or at least the folder structure or naming so that hackers cannot easily locate some of the more important parts of the file directory.
  • Putting WordPress into debug mode    or saving queries can be useful when troubleshooting your system in the future.
  • When you need to modify content-related settings. Many content settings are stored in the wp-config.php file. For example, you can change the settings for WordPress revisions , how often the Trash is emptied, and how often AutoSave is completed.
  • Set the PHP memory limit so that large websites and multi-site configurations end up running on WordPress.
  • When you need to update important security settings.
  • To change the automatic updates settings for WordPress core. Although it is a good idea to keep it automatically updated for security purposes, there are some cases where deactivating it may be beneficial.
  • To completely lock the wp-config.php file so that no one can access it.

If you are interested in the intricacies of this basic file, you can learn more about it in our following article, which includes a comprehensive explanation of the wp-config file and how to modify it.

The .htaccess file

The .htaccess file is located in the WordPress root directory, and htaccess is short for hyper-text access.

This file acts as a basic configuration file on the hosting server and controls access to files and folders, and it also controls the permalink structure.

 Special for your website and make it look clean and uniform.

note:

This file may be hidden, so you need to enable the Show hidden files option to see and access it. Also, some hosting companies do not support this file

In general, you should not modify the .htaccess file. However, there are many actions and redirects that you can activate by adding to or modifying the file. For example, you can set up redirection rules, block IP addresses, and put a password on your site through it.

A .htaccess file is best when you need to set the following rules or complete these actions:

  • Increase the maximum upload size for media items and files.
  • Block access to specific IP addresses.
  • Set up redirects from one URL to another.
  • Add rules to the file so that cached content is presented more efficiently.
  • Redirect HTTP to HTTPS.

Read more: Full explanation of htaccess. File functions, uses, and most important modifications

The file pluggable.php

The pluggable.php file is one of the core files in the WordPress core and is located in the wp-include folder of WordPress.

This file contains some basic WordPress functionality that the developer or site admin can override or customize by writing their own code. The most important of these functions that can be bypassed or modified are:

  • wp_mail: This function is used to send emails and can therefore be modified to customize your WordPress email template.
  • wp_password_change_notification: This function sends an email to the user when the password is changed.
  • wp_new_user_notification : This function is used to send an email directly after a new user registers.
  • auth_redirect: This function verifies that the user is already logged in to the WordPress site, and redirects them to the login page when needed.
    And other custom functions..

Sometimes an error occurs called the pluggable.php file error, and it occurs when the user tries to bypass one of these functions by writing custom code or by installing an add-on on the site due to the inability of this code or add-on to override the function correctly.

The following article explains in detail what is the pluggable.php file in WordPress? How do we solve his mistakes?

The file calss-query-wp.php

The file calss-query-wp.php is located in the wp-includes folder in the root directory of your WordPress site. It is a programming class that enables you to write custom queries to obtain specific information from the WordPress database.

This row is often used to get content that meets certain specified conditions from the database. It is considered one of the preferred methods among developers to mainly query articles from the WordPress database due to its ease of use.

To learn more about this file and how to use it on a WordPress website, we advise you to read this article .

And here we have reached the end of our explanation of the WordPress programming system and reviewed its most important files and folders. Of course, basic WordPress has a much more file and folder system than we mentioned in this article. We recommend checking out the following link which contains a short list of all your website files and where they are located within your WordPress installation.

Questions and answers about WordPress programming

  • What is the importance of updating the WordPress core ?

The WordPress core has a specific version number (the current version). It receives updates for feature additions, improvements, bug fixes, and patches for security issues and system vulnerabilities.

Therefore, it is important to know how to always update WordPress to the latest version, as old versions of both the basic WordPress core and external plugins and templates are the first reason behind hacking WordPress sites.

  • What skills do I need to learn WordPress programming?

You must, of course, possess a set of skills to contribute to WordPress programming, the most important of which are (MySQL, Javascript, PHP). These basic skills enable you to understand the programming of the WordPress core system and its working mechanism, work to improve it, issue updates to it, fix errors if any, and test new updates and fixes.

  • How do I safely edit core WordPress files?

When working with core WordPress files, it’s important not to change any settings unless you know what you’re doing. These files are the foundation of your WordPress installation and any wrong modification could cause your site to crash.

So the best practice before any modification to the file structure is to backup your site before making any repairs or modifications to these files. You can do backups manually, or use custom add-ons to do so.

Conclusion

WordPress is described as a beginner-friendly platform, and for this reason, it is a popular choice with many first-time website owners. You can get a lot done with WordPress without needing any technical knowledge.

But your WordPress site is more complicated than it seems. There’s a lot that goes on behind the scenes to make it work properly. If you want to get the most out of the platform, it helps to understand how its basic elements work.

As you become more familiar with the core WordPress files and what each does, you will have a deeper understanding of your site. You’ll learn to troubleshoot problems with your site more quickly.

In this article, we explained a general idea about these files and folders related to the WordPress programming system. If you have any questions about one of them, you can leave your question about it in the comments.

Avatar photo
I am a young man who has been working in WordPress and e-marketing for 10 years. I would like to share my experience with you so that we can become professional in WordPress I will be happy to share the experience with you.