Structure of WordPress files: WordPress already controls over 30 percent of the internet ‘s top 10 million websites. For 8 straight years, it has been called the fastest developing content management framework. The platform is popular because it helps users to create a website on their own easily. Yet WordPress is more than just a forum for creating websites. It’s a civilization that encompasses the world and gets larger every year. This article is for you if you are an aspiring member of this WordPress network. Much as a child studies alphabets before learning how to read sentences and how to write, a step in learning more about WordPress is to grasp the WordPress file structure. So, here is a reference to the framework and databases of WordPress.
WordPress File Structure
Two things happen after WordPress is built on your website. One is installed on your website with a bunch of scripts, and two are installed; a database is built. And we must consider these files and the archive in order to understand the simple WordPress file structure.
What are databases and WordPress files?
Let’s take a look at the WordPress archives in order to appreciate the WordPress file structure. You should think about WordPress files as follows: codes, uploads, and configurations.
1 > Codes
WordPress codes are what bricks are to a house. They are used for the construction of a WordPress account. It is possible to break codes into three parts: Heart, Plugins, and Themes. To build your platform, Heart, Plugins and Themes work in tandem.
The centre is WordPress ‘s spirit. The most relevant files in the CMS are located here. There are 3 Main files on WordPress-wp-admin, wp-content, wp-includes. Your site could be disrupted by some alteration in the heart.
In any way you choose, plugins and themes help develop your WordPress platform. When a plugin is installed, it is stored in a file called Plugins. And in a file called Themes, themes are stored.
2 > Uploads
It becomes a part of WordPress when you write a post with photos. Upload and transfer the images as a file, and the file is called Uploads.
3 > Configuration
This includes configuration files, such as wp-config, which helps to link the database files.
So what is a database exactly? The archive is like a cupboard where you put things. In this case, in the mysql folder, everything from posts to comments on the WordPress account is stored.
In the next half of the article, more on the database. Let ‘s address the layout of the WordPress directory first.
WordPress is made up of a lot of directories, and wp-admin, wp-content, wp-includes, and wp-config are the key ones. We’re going to discover what the files are and where they can be accessed, which will give us an understanding of the layout of WordPress files.
You will have to visit your web host account to access these files. Sign in and go to a website called cPanel on your web host. There, you should be able to find a File Manager choice. Choose that, and a page opens that looks something like this:
This is a standard website for a file manager. There are a tonne of files on the left-hand page. A folder called public html can be found in the wp-admin, wp-content, wp-includes, and wp-config folders. (You can see wp-admin, wp-content, wp-includes, and wp-config right under public html in the image below).
WordPress Files Core:
There are administrative files in the wp-admin folder that control the WordPress dashboard. The WordPress dashboard is the first thing that you see since logging into the WordPress account. This is how it looks:
WordPress tests whether the passwords you have issued are right, or if you are an administrator or a basic visitor with restricted access to the web while you are attempting to log in to the dashboard. Files in the wp-admin folder allow these tasks to be carried out by WordPress. The files also allow for a variety of other features, such as loading the dashboard, linking to the database, etc.
The WP-includes files are responsible for the way WordPress appears. The size of this folder is wide and most of the main WordPress files are stored here. The text we see on WordPress, the text font, both of these are allowed in the wp-includes folder by the scripts. The files also have rules, hierarchies, and some of the WordPress features include an action command.
The wp-content folder is where you store themes, plugins and other uploads. It’s saved in the Themes folder once you add a theme; plugins are installed in the Plugins folder and the photos you upload are saved in the Uploads folder.
Understanding how things work in wp-content will assist us to fully understand the layout of the WordPress code. Let’s instal my site with a WordPress plugin. On my blog, I have quite a lot of plugins. There are plugins such as Better WP Protection, BJ Lazy Load, BlogVault Real Time Backup, etc. on the right-hand side, as you can see (image below).
I installed and activated a new plugin called Instagram Slider Widget on my WordPress site.
The plugin now appears in the Plugin folder of the database which you can see in the screenshot below.
It goes into the Upload folder if you upload a photo to the WordPress account. To show this, I posted a picture to my blog.
I will see the document, along with its variants (WordPress creates various sizes on its own) in the wp-content folder after uploading the document, when I visit the File Manager page again.
Hacking also attacks wp-admin, wp-content, and wp-includes directories. Mainly since most website owners don’t always access the File Manager or look at these files, they hide malware in these files. As long as the website owner is unaware of the breach, hackers will start using a website. When a site owner learns that their site has been breached, they will clean it, restricting the entry of the hacker to the site. Fear of being found out too fast triggers hackers in areas where people are unlikely to look at hiding their poor passwords.
The wp-config file works between WordPress and the servers as a mediator. This file is highly critical and can not be changed. The association between the database and WordPress can be disrupted by modifications. Your domain would appear null if wp-config is unable to link your WordPress account to the database. Anyone who visits the site will see a message saying ‘Error linking to a database.’
In the public html archive, .htaccess is present and you’d find it doesn’t have an extension like .html or .txt. To this file, or to php. You can make multiple updates to the WordPress account by using .htaccess. It can help you encrypt files and folders with passwords; it can block those IP addresses from accessing your site; it can also, among other things, help redirect users from one website to another.
In the public html archive, .htaccess is often concealed and might not exist. What you need to do when that’s the case is go back to cPanel and press File Manager. There will be a window where you will need to pick ‘Display Hidden Files.’
We come to the end of the WordPress file system for this. We will explore the WordPress database more, as it appears to function very closely with the archives and folders of WordPress.
With several tables, a database is like a storage cupboard. In a organised way, it holds files. The database has eleven tables by example. You can think of tables as storage spaces within a cupboard. When you continue using the WordPress website, posting more entries, gaining attention to the blog, the tables can grow. Database tables have a wp default prefix that can be updated at will. These tables can be optimised and restored and, using a backup plugin like BlogVault, they can also be published or backed up. Each table has a function of its own, and we will discuss these functions below. But first, let’s see how the database can be used.
You will have to visit your web hosting account in order to access your servers. Sign in and go to a website called cPanel on your web host. There, you should be able to locate the phpMyAdmin choice. Choose that, and a page opens that looks something like this:
Now let’s take a look at what comprises each of these tables:
Table 1: wp commentmeta
For comments left on your WordPress page, wp commentmeta stores metadata. In this table, data on items such as whether a submission is accepted or pending or trashed is kept.
Table 2: wp comments
Wp comments stores the details left on your account about comments. This includes the unique number assigned to each message, email addresses, message author’s IP addresses and URL, pingback or trackback, comments answers, time and date of the comment, and other items.
Table 3: wp links
Wp links takes care of blogrolls that were fashionable in the past (a list of hyperlinks to other blogs or websites). WordPress websites had blogrolls by default in the past, but there have been no blogrolls since version 3.5. For backward continuity, the table stays in the archive, i.e. if anyone is already using older versions of WordPress that have blogrolls, this basic table may assist to take care of the blogroll functionality.
Table 4: wp options
There is an alternative on your WordPress dashboard called Setting. Wp options stores information relevant to the feature of the Settings. You can see options that allow you to change the site title, tagline, website address (URL), etc. if you pick Setting from your WordPress dashboard. This data is stored in the table of wp options. Let ‘s look at my website’s wp-options table.
From my WordPress dashboard, I visited the Setting choice. If you can see in the image above,’ My Blog’ is my domain title, and ‘Yet another WordPress site’ is the tagline. In my wp options table, I notice that the same information is stored.
Table 5: wp postmeta
For posts and sites, wp postmeta stores metadata (like Post ID, meta ID, amongst other things). Identification numbers allocated to each post help to structurally store them. The IDs also make it easy for articles and web pages to be found as needed.
Table 6: wp posts
Information from blogs, pages and the navigation bar is saved by wp posts. How does it vary from wp-postmeta? You can see unique I d number assigned to posts and pages in wp postmeta, while wp posts includes details such as post name, author name, post date, and other items. Let’s see how this table holds the specifics of a message.
I have published on my website a post called ‘Structure of a WordPress Blog.’
As soon as my post was published, information of the post appears on the wp_posts table.
Table 7: wp_terms
wp_terms stores three things: categories for tags of posts, categories of posts and link categories. To understand what these things are, let’s take a look at the pictures below:
Tags of posts
In the three pictures above, we have:
- WP Security Audit Log (tag)
- Review (post categories)
- Uncategorized (post categories)
- Blogroll (link categories)
Table 8: wp-term-relation relationships
Wp term relationships stores relationship data from the wp terms table for groups and tags. What is that meant to mean? Let’s claim that there is a post called A on your website. It is part of Tier 9. This table helps decide who, and not any other category, post A belongs to 9 categories.
Table 9: wp term taxonomy
Wp term taxonomy stores taxonomy explanations (tag, link, or category) for the entries in the table of wp terms. This table helps to separate marks, ties or divisions from each other.
Table 10: wp usermeta
A WordPress user’s wp usermeta stores metadata. Your user ID is 1, for example, and your fellow admin’s user ID is 2. In the wp usermeta table, this basic information is stored.
Table 11: wp users
For WordPress users, wp users stores info. How does it vary from wp usermeta? Well, the wp usermeta table has stored specific user I d numbers, but other user information such as username, user login name , email address, etc. are stored in the wp usermeta table.
To give you an example, on my WordPress website, I created a new user.
I looked up my wp_users table and saw information of the new user had been stored in there.
With that, we have covered the basics of the database and WordPress file structure.
If you have any questions around WordPress file structure or WordPress database or WordPress security (as that is what we specialize in) please do write to us. And thanks for reading.