0% found this document useful (0 votes)
99 views19 pages

Beginner's Guide To WordPress File Structure & Database

Uploaded by

tr_aymen1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views19 pages

Beginner's Guide To WordPress File Structure & Database

Uploaded by

tr_aymen1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE a
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

Beginner’s Guide to Understanding WordPress


File Structure & Database
by Sufia Banu | Jan 2, 2018 | About WordPress

WordPress file structure: WordPress currently powers over 30% of the


top 10 million websites on the internet. It’s been named the fastest
growing content management system for 8 consecutive years. The
platform is popular because it enables users to build a website quickly on
their own. But WordPress is more than just a website building platform.
It’s a community spanning across the globe that is growing stronger every
year. If you are a budding member of this WordPress community, this post
is for you. Just as a child learns alphabets before learning how to read
sentences and how to write, understanding the WordPress file structure is
a stepping stone towards learning more about WordPress. So here’s a
guide to WordPress structure and database.

WordPress File Structure


https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 1/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

After WordPress installs on your website, two things happen. One, a bunch

START
of files are installed into your site and two; a database is created. FREE
And in
Enter
orderyour
tosite URL to SCANthe
understand for malware on 150+ parameters
basic WordPress file structure, we must
understand these files and the database. SCAN >>

What are WordPress Files and Database?

To understand the WordPress file structure, let’s take a look at the files of
WordPress. Files of WordPress can be thought of as follows: codes,
uploads, and configurations.

1> Code –
Codes to WordPress is what bricks are to a building. They are used to build
a WordPress site. Codes can be divided into three parts – Core, Plugins,
and Themes. Core, Plugins and Themes work in tandem to create your
site.

The core is the heart of WordPress. The CMS’ most important files are
stored here. WordPress has 3 Core files – wp-admin, wp-content, wp-
includes. Any modification in the core could break your site.

Plugins and themes help design your WordPress site in any way you
desire. When you install a plugin it is stored in a file called Plugins. And
themes are stored in a file called Themes.

2> Uploads –
When you write a post with images, it becomes a part of WordPress. The
images are uploaded and stored as a file, and the file is called Uploads.

3> Con guration –


This includes configuration files like wp-config that helps connect the files
to the database.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 2/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

But what exactly is a database? The database is like a cupboard where


things are stored. In this case, everything from posts to comments on ✕
START FREE
youryour
Enter WordPress
site URLsite is stored
to SCAN in the mysql
for malware database.
on 150+ parameters
SCAN >>
More on the database in the next half of the post. Let’s first discuss
WordPress directory structure.

WordPress Files:

WordPress consists of a bunch of files, and the main ones are wp-admin,
wp-content, wp-includes, and wp-config. Going ahead, we’ll learn
what the files are and where can they be found which will give us an idea
of WordPress file structure.

To access these files, you will have to visit your web host account. Log in
to your web host and go to a page called cPanel. There, you should be able
to find an option for File Manager. Select that, and a page will open that
would look something like this:

This is a typical file manager page. On the left-hand side, there are a
bunch of folders. The wp-admin, wp-content, wp-includes, and wp-config
files can be found in a folder called public_html. (In the picture below,
you can see wp-admin, wp-content, wp-includes, and wp-config right
under public_html).

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 3/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

Core WordPress Files:

1. wp-admin
The wp-admin folder contains administrative files that power the
WordPress dashboard. The first thing that you see after logging into your
WordPress site is the WordPress dashboard. It looks like this:

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 4/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

When you are trying to log in to the dashboard, WordPress checks whether
the credentials that you have provided are correct, or whether you are an
admin or a simple contributor with limited access to the site. The files in
the wp-admin folder enable WordPress to carry out these functions. The
files also enable a bunch of other functions like loading of the dashboard,
making a connection to the database, etc.

2. wp-includes

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 5/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

Files in the wp-includes are responsible for how WordPress looks. This
folder is large in size, and most of the WordPress core files are ✕
START FREE
stored
Enter yourhere. Thetotext
site URL SCANthat
forwe see on
malware onWordPress, the font of the text – all
150+ parameters
these are enabled by the files in the wp-includes folder. TheSCAN >>
files also
contain rules, hierarchies, and action command for some of the WordPress
features.

3. wp-content
The wp-content folder is where themes, plugins and other uploads
are stored. Whenever you install a theme, it’s stored in the Themes
folder; plugins are installed in the Plugins folder and the images that you
upload are stored in the Uploads folder.

– Plugin Folder
Understanding how things work in wp-content will help us further
understand the WordPress file structure. Let’s install a WordPress plugin on
my site. I have quite a number of plugins on my site. As you can see
(image below) on the right-hand side, there are plugins like Better WP
Security, BJ Lazy Load, BlogVault Real Time Backup, etc.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 6/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

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.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 7/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

– Upload Folder
Everytime you upload a picture on your WordPress site, it goes into the
Upload folder. To demonstrate, I’ve uploaded an image on my site. I’ve
named the image, MalCare.

After uploading the image, when I visit the File Manager page again, I can
see the image, along with its variations (WordPress generates different
sizes on its own) in the wp-content folder.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 8/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

wp-admin, wp-content, and wp-includes folders are often targeted by


hackers. They hide malware in these folders mainly because most website
owners don’t often visit the File Manager or look into these folders.
Hackers can keep utilizing a website as long as the website owner
is unaware of the hack. Once a site owner finds out that their site has
been hacked, they’ll clean it which will block the hacker’s access to the
site. Fear of being found out too soon prompts hackers to hide their bad
codes in places where people are unlikely to look into.

wp-con g

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 9/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

The wp-config file acts as a mediator between WordPress and the


database. It’s an extremely important file and should not be modified.
Modifications can break the connection between the database and
WordPress. If wp-config is unable to connect your WordPress site
with the database, your site will appear blank. Anyone visiting your
site will see a message saying ‘error establishing a database connection.’

.htaccess File
.htaccess is present in the public_html folder, and you’d notice that it has
no extension like .html or .txt. or php to this file. Using .htaccess you
can make several changes to your WordPress site. It can help you

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 10/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

password protect files and directory; it can prevent certain IP addresses


from accessing your site, it can even help redirect visitors from one page ✕
START FREE
to another,
Enter your siteamong
URL toother
SCANthings.
for malware on 150+ parameters
SCAN >>
Sometimes .htaccess is hidden and may not appear in the public_html
folder. When that’s the case, what you need to do is go back to the cPanel,
and click on File Manager. A popup will appear where you’ll have to
select ‘Show Hidden Files.’

With this, we come to the end of the WordPress file structure. Going ahead
we’ll discuss WordPress database as it tends to work very closely with the
WordPress files and directories.

Database:

A database is like a storage cupboard with many shelves. It stores files in


a structured manner. By default, the database has eleven tables. The
tables can be thought of storage spaces inside a cupboard. The tables will
expand as you begin using the WordPress website, adding more posts,
attracting comments to the site. Database tables have a default prefix
wp_ which can be changed at will. These tables can be optimized and
repaired, and they can also be exported or backed up using a backup
plugin like BlogVault. Each table has its own function, and we are going to
discuss these functions below. But first, let’s see how you can access the
database.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 11/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

To access your database, you will have to visit your web host account. Log
in to your web host and go to a page called cPanel. There, you should be ✕
START FREE
able your
Enter to find
site an
URLoption forfor
to SCAN phpMyAdmin. Select
malware on 150+ that, and a page will open
parameters
that would look something like this: SCAN >>

Now let’s take a look at what each of these tables contains:

Table 1: wp_commentmeta
wp_commentmeta stores metadata for comments left on your WordPress
site. Information on things like whether a comment is approved, or
pending or trashed are stored in this table.

Table 2: wp_comments
wp_comments stores information surrounding comments left on your
account. It includes unique number assigned to each comment, email
addresses, IP Addresses and URL for the comment author, pingback or
trackback, replies to comments, time and date of the comment, among
other things.

Table 3: wp_links
wp_links takes care of blogrolls (a list of hyperlinks to other blogs or
websites) that was fashionable in the past. WordPress websites had
blogroll by default in the past, but since version 3.5 there have been no
blogrolls. The table remains in the database for backward compatibility,
i.e. if someone is still using older versions of WordPress that has blogrolls,
this particular table will help taking care of the blogroll feature.

Table 4: wp_options

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 12/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

In your WordPress dashboard, there is an option called Setting.


wp_options stores data related to that Settings feature. If you select ✕
START FREE
Setting
Enter yourfrom yourtoWordPress
site URL dashboard,
SCAN for malware you’ll
on 150+ see options that enable you
parameters
SCAN >>
to change site title, tagline, site address (URL), etc. This information is
stored in the wp_options table. Let’s see the wp_options table on my
website.

I visited the Setting option from my WordPress dashboard. As you can see
in the picture above, my Site Title is ‘My Blog’, and the Tagline is ‘Just
another WordPress site’. I found that the same information is stored in my
wp_options table. Look at the picture below.

Table 5: wp_postmeta
wp_postmeta stores metadata (like Post ID, meta ID, among other things)
for posts and pages. Identification numbers allotted to each post helps to
store them in a structured manner. The IDs also makes it easier to find
posts and web pages when they are needed.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 13/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

Table 6: wp_posts

START
wp_posts stores information from posts, pages, and the navigation FREE
menu.
Enter
Howyour
is itsite URL tofrom
different SCANwp_postmeta?
for malware on 150+ parameters you’ll find unique
In wp_postmeta,
SCAN >>
identification number allotted to posts and pages whereas in
wp_posts consists of information like post name, author name, post
date among other things. Let’s see how the information of a post is stored
in this table.

I published a post called ‘Structure of a WordPress Site’ on my website.

As soon as my post was published, information of the post appears on the


wp_posts table.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 14/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

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

Post Categories

Link Categories

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 15/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>

In the three pictures above, we have:

WP Security Audit Log (tag)


Review (post categories)
Uncategorized (post categories)
Blogroll (link categories)

These tags, post categories, and link categories are present in the
wp_terms table of my database.

Table 8: wp_term_relationships
wp_term_relationships stores relationship data for categories and tags
from the wp_terms table. What does that mean? Let’s say there is a post
on your website named A. It belongs to the category 9. This table helps
determine that post A belongs to 9 categories and not some other
category.

Table 9: wp_term_taxonomy
wp_term_taxonomy stores descriptions of the taxonomy (tag, link, or
category) for the entries in the wp_terms table. This table helps
differentiate between tags, or links or categories.

Table 10: wp_usermeta


wp_usermeta stores metadata of a WordPress user. For instance, your user
ID is 1, and your fellow admin’s user ID is 2. This particular information is

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 16/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

stored in the wp_usermeta table.



Table 11: wp_users START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>
wp_users stores data for WordPress users. How is it different to
wp_usermeta? Well, the wp_usermeta table stored unique identification
number of users but the wp_users table stores other user information like
the Username, User Login Name, Email address, etc.

To give you an idea, I created a new user on my WordPress website.

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.

Join 20,000+ people who get the best of WordPress Security


delivered every week.

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 17/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database


Enter Your Goto Email ... START FREE
Enter your site URL to SCAN for malware on 150+ parameters
SCAN >>
Yes, Let's Grow Now

I agree to MalCare Terms of Service and Privacy Policy

You may like these

Step-by-Step
How To Install Checklist: 17 How to Set Up
and Setup Important Right WordPress
WordPress Things To Do File
Multisite After Installing Permissions?
Network? WordPress

© 2020 MalCare All rights reserved.

Key Features ▼

Legal and Privacy ▼

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 18/19
14/04/2020 Beginner’s Guide To WordPress File Structure & Database

Help Resources ▼ ✕
START FREE
Enter your site URL to SCAN for malware on 150+ parameters
Affiliate Partners ▼ SCAN >>

Comparison Pages ▼

Social ▼

Top Articles ▼

Contact Us ▼

About ▼

SHARE

https://www.malcare.com/blog/beginners-guide-to-understanding-the-structure-of-a-wordpress-site/ 19/19

You might also like