Article read time - 6 minutes

In this guide, we have covered all the details of the internal functions within WordPress.

We all use and love WordPress for many reasons. It’s free, customizable, and very user-friendly – allowing anyone to develop a website without coding knowledge. In fact, most of us have gone for years using the Content Management System without worrying about its internal functions.

Even today, it may seem like something that you should not bother with learning.

But do you know that some common WordPress problems cannot be resolved without digging into the database? Many of you may have also faced the same situation when you had to take external help for technical issues. Being aware of the internal functions may have saved you from the hassle of contacting a professional.

Well, knowing the internal processes will help you manage the website more efficiently. It will also enable you to troubleshoot some common WordPress errors without relying on others.

And this guide is aimed to help you with just that. Here, you will learn about:

  • The files part of the internal structure of WordPress
  • The database
  • How WordPress retrieves data for the user
  • The files that you should backup

So without further ado, let’s get behind the scenes and find out how WordPress works.

The WordPress Internal Structure

When you launch a WordPress website, two things happen: 1) A bunch of files are installed on your site, and 2) the system creates a database.

You can access both of these files through the account provided by your hosting provider. To access the files installed on your site, log in to the web host and go to a page called cPanel.

From there, you can choose the option for File Manager, which will give you an inside look at the files installed on your site.

To access the database, simply choose the Database Management Software such as phpMyAdmin from the cPanel. This will open up the table where WordPress stores all your posts and pages.

WordPress Files

When you enter the File Manager page, you will see many files and folders used to build a WordPress site.

wp file manager

However, the most important ones are:

  • wp-admin
  • wp-content
  • wp-includes

These can be found in the “public_html” file inside the File Manager. But remember that modifying any part of these pages can literally break your site. So don’t attempt any DIY without knowing what you are doing.

wp-admin

As the name suggests, the wp-admin contains the files that are responsible for powering the Admin dashboard. This is the file that gives you access to the admin page and carries out functions like write posts, moderate comments, verify themes and plugins, etc.

Furthermore, this area also checks if the credentials you have provided are correct and whether you are the admin or someone with limited ability to contribute to the webpage.

wp-content

On a fresh WordPress installation, you will find three sub-folders inside the wp-content file: Themes, Plugins, and Uploads.

Whenever you install a theme, it’s stored in the Themes folder, and the plugins are inside the Plugins folder. The images that you upload through the Media Library are stored in the Uploads folder.

wp-includes

The files in the wp-includes are responsible for how the WordPress site looks and functions with other features. From the text’s font to the widgets and caches – the wp-includes has all the core files for WordPress.

The files also contain rules, hierarchies, and action commands for some of the WordPress features.

Again, you don’t want to modify any files present in this directory.

The .htaccess and wp-config.php files

Besides the above core files, you will find .htaccess and wp-config.php a part of every WordPress installation. They are also part of the public_html folder.

.htaccess

Short for hypertext access, controls access to all your files and folders. Most importantly, it manages how your site displays the permalinks. When you make changes to the permalink structure, the .htaccess file is updated with new instructions for the server.

You can also use the .htaccess to alter the security settings of your website and manage the redirects.

wp-config.php

The wp-config.php file works as a mediator between your WordPress site and the database. It contains all the WordPress settings that help establish a reliable connection between the two.

Without the information, your website will not work and show the ‘error establishing database connection’ error.

The wp-config-php can be used to edit your website’s database settings, tweak your memory limit, and even turn on WordPress auto-updates. However, this is a critical file, and we recommend that you don’t modify it without proper knowledge.

Database:

The database works like a storage shelf for all your posts, pages, and comments. By default, you will see only twelve tables in the database. But as you expand your site and add more content, the tables will also increase.

Database tables have a default prefix wp_, which can be changed at will. You can also optimize and repair them as required. But don’t forget to backup your website so you can quickly restore them if anything goes wrong.

Here is a breakdown of the tables that are part of the WordPress database.

wp database

Table 1: wp_commentmeta

This table stores the metadata for comments left on your WordPress site. For example, information like whether a comment is approved, pending, or thrown into the bin is stored in this table.

Table 2: wp_comments

The wp_comments contains unique information about each comment that is left on your website. For example, the author’s email address, IP address, time of messaging, etc. are included in this table.

Table 3: wp_links

This takes care of the blogrolls or a list of hyperlinks to other blogs or websites created within the previous versions of WordPress.

Table 4: wp_options

The wp_options stores’ data are related to the Settings feature that is accessible through the main dashboard. Any changes you make to the site title, tagline, URL, etc. through the settings are stored in the wp_options table.

Table 5: wp_postmeta

This table contains the Meta information about your posts, pages, and custom posts. Each file in this table includes a unique identification number that helps locate the posts and webpages when they are required.

Table 6: wp_posts

As the name suggests, this table stores information from posts, pages, and the navigation menu.

Table 7: wp_termmeta

Term meta allows developers to store custom data about terms in a standard way. For example, an online store can store the metadata for specific products and categories through the specified table.

Table 8: wp_terms

wp_terms stores three things: categories for tags of posts, categories of posts, and link categories.

Table 9: wp_term_relationships

This table stores relationship data for categories and tags from the wp_terms table. For example, you have a post title A that belongs to category 7. The wp_term_relationship will determine that A belongs in the 7 category and none other.

Table 10: wp_term_taxonomy

This table defines the taxonomies (links, tag, and category) for terms described in the wp_terms table.

Table 11: wp_usermeta

The wp_usermeta contains Meta information about the registered users on your website.

Table 12: wp_users

This part of the database contains user information like the username, passwords, and email addresses associated with your WordPress website.

How WordPress Responds to a User’s Request?

For an average user, asking to open a website is merely entering the specified URL and automatically having the web page load to their screen.

But the internal functions are much more than that.

When someone requests to view your webpage, WordPress dynamically generates an HTML code to serve the user. The steps that are followed are outlined below.

  1. WordPress calls the required PHP script.
  2. The WordPress core communicates with the database to acquire the relevant posts and pages.
  3. It combines the data with the plugin and themes information to ‘dynamically’ generate the HTML code for the visitor.

Similarly, when a post receives a comment or other interaction, the WordPress internal functions save them in the database for future use. It also notifies the administrator regarding the pending number of comments via the main dashboard.

Do I Need to back up?

Yes, definitely! Data loss is a normal part of functioning a website on the World Wide Web. It can occur due to many factors, including programming malfunction, hacks, plugin and themes error, and natural disasters.

Regardless of the reason, you must regularly back up specific files of your website to ensure that you can retrieve them in case of a data loss. These files include:

  • Core WordPress files (found in public_html file)
  • Files that contain information about your posts, plugins, themes,
  • WordPress configuration files
  • Your WordPress Database

Final Words

With that, we have covered the basics you need to know about the database and the WordPress file structure. Beyond curiosity, it is essential that you know about these files to avoid accidental modification and manage your website more effectively.

Leave a Reply
Comment policy: We value comments and the time that visitors to our blog spend to give feedback. Please note that all comments are manually moderated and any deemed to be spam or promotional will be deleted.