WordPress Under The Hood


This workshop shows the file structure of any WordPress installation with the emphasis on wp-config.php and what is in the wp-content folder. It will end with an overview and a look at the MySQL database.

Learning outcomes

To allow people to get familiar with how WordPress works on a most fundamental level so one can become more comfortable and knowledgeable with their website.

Comprehension questions

  1. What is the purpose of wp-config.php?
  2. Where are images stored in any WP site?
  3. What can happen to a database when a plugin is installed?
  4. Where are the theme (and child theme if used) files kept?

Transcript

0:01
Hi, my name is Bud Kraus. I’m a WordPress instructor and site developer. I’ve been using WordPress for about 10 years, I’m very active in the WordPress community in New York City. I’ve attended and spoken at many word camps. Today, we’re gonna look at WordPress under the hood, what do I mean, we’re gonna look at the component parts that make up WordPress, specifically, the file and folder structure of any site, as well as the database. Those are the components we want to have a look at. First, we’re gonna look at the WordPress file structure. And when we do that, I’m going to focus on one particular file, which is mission critical for every WordPress site. And that’s the WP config file. You may hear people talk about that. That’s really an important file in your WordPress installation. And then we’re going to look at the WordPress database itself. But we’re going to focus on one of the database tables. It’s the options table. Now, why would anybody want to know any of this stuff? Well, if you’re going to do Child Theme development, that is if you’re going to customize your theme, change the styles add functionality, remove functionality, you’re going to need to know Child Theme development. And you’re going to need to know everything I’m going to show here and more. Also, if you ever have to migrate a site manually from one web host to another, you’re going to need to know everything I’m going to show you here as well. And then also, this gives you another way to manage your site by uploading plugins and themes are deleting plugins and themes by using FTP File Transfer Protocol application, which I’m going to show you in a minute. What am I not going to do? Well, I’m not going to make you into a big type developer in a few short minutes, that’s not going to happen. But as I’ve already said, Everything I’m going to show you you need to know if you’re going to be a developer, I’m not going to troubleshoot any issues you may face when working on a WordPress site. And I am not going to teach you in detail the two applications I’m going to show you in this workshop. So let’s get started. To show you the file and folder structure of any WordPress site, you need to use an FTP application. And here I’m using one that’s really familiar with a lot of people called file Zilla, like WordPress. It’s open source, and it’s free. And I will give you some resources below how to get file Zilla, and alternative FTP applications you can use to access your site files that make up your WordPress installation. So right over here on the left hand side, well, that’s just files on my computer right here. I’m not going to really pay any attention to that. And I’m going to log in right now. I’m going to click on File site manager. I’ve already set up the connection to circle America dot site. And when I set this up, I need to know a couple things. One, what is the host name? In this case? It’s circle America dot site. Two, what is the username? Well, but it’s circle America dad site, and three is the password, which I’m not going to tell you. Okay, now, where did I get all that? I got that by setting up FTP credentials from my web host. What is the web host I’m using here, I’m using siteground. But no matter what web hosts you use, it’s pretty easy to set up these credentials so that you can log in using FTP. And that’s exactly what I’m going to do right now. Okay, and I see I have two different installations here. And the one I want is clearly Mark circle America dad site. And if I click on that, it opens up three folders of which the one that’s the important one is public underscore HTML. Most web hosts install WordPress into public underscore HTML. So I’m going to just click on that. And now I’ll see all my files that make up my WordPress installation. So this is the root of that installation. And you’ll see a whole bunch of PHP files and a couple of folders here. And these are just the typical files you’ll see in any WordPress installation. The one I want to focus in on is WP config. And the reason why I want to focus in on that is because it’s this file, which communicates with your WordPress database. Now before I do anything I’m going to highlight as I highlight this, I am going to now click on View edit

4:33
and this opens up a text edit file. And although I don’t know everything here, I really don’t need to know everything. What I want to take note of is the database name itself DB underscore name is this over here. dB underscore user a DB underscore password now this stuff over here is needed so my WordPress installation can connect or communicate with the database Okay, today database is totally separate. So there has to be a way to how do I talk to the database? Well, all this stuff is used to communicate with the database. So now you understand why this is such an important file. Let’s just take a note of this here. It’s DB df and some other characters, because I want to just remember that and you’ll see why in a second. And if I scroll down just a little bit more. And oh, just past all this stuff over here, I have something about the database table prefix, and this will help me identify the database too. So it says five, a four, underscore. Okay, let’s just keep that in mind. Now if for any reason I needed to make changes to anything about the database and the username and password, I could do it right through this file. It’s just a plain old text file. Anyway, I don’t need to do that. This is just a demo. And I am going to just close this. Now let’s look at the folders over here. Well, the ones that are really important to us are WP admin, WP content and WP includes Okay, you’ll never touch WP admin and WP includes that’s WordPress itself. That is those are the files that make up WordPress core. You don’t need to you shouldn’t touch any of those files. Anytime you do an update of WordPress, those files will get overwritten. So you don’t want to ever mess with that. And over here, WP content. Well, that’s the important stuff for people like you and me. And we’ll see that it has a number of folders here too. Now, the ones that you will see all the time are the folders called plugins, themes, uploads, upgrades, these other ones over here, were generated when I installed a particular plugin, that’s going to happen from time to time depending on the plugin. And if I click on the word plugins, you’ll see all the plugins in my installation. So it’s pretty easy to identify the plugins because the name of the folder is usually the name of the plugin. So each plugin has its own unique folder. And of course, if I wanted to delete a plug in, I could do this right over here by deleting it. Or if I wanted to upload a plugin, I could just drag the plugin over here on my from my computer and drag it into here, I’m not gonna do any of those. But it’s very easy to move files and folders around using this application. And if I go back up, I will see that I have themes, I have four themes here. And the 20s. That is the WordPress stack themes are over here. And any theme that you use, no matter what theme, it’ll always have at least two files, one style that CSS which contains most if not all the styling information for your site, as well as functions dot PHP, which contains customized PHP to provide additional functionality or even to remove some functionality for your site. Now, of course, you’re never going to edit those files directly. Because you’re going to create a child theme in its own folder. And inside of that folder, are where you’re going to make the changes that customize your website. So don’t ever touch these because if these ever get updated, and they do, your changes will get totally overwritten. And the other one I want to show you is up loads. And this is where your media is kept your images, PDFs, any other kinds of documents that you upload to your Media Library, that’s where they’re going to be stored in these folders. You can see for each year, there’s a folder, and inside of let’s just take 2020 you can see what months, I uploaded images to my Media Library. And over here, I have three different images.

9:03
I could delete this over here. Now, here’s what you don’t really want to ever do. You don’t want to upload images here, or any documents here because those files must be uploaded to the Media Library and never uploaded using FTP. Okay, having said that, we now see that I’m in my root, and we’ve gone over the file and folder structure of a typical WordPress website. Now let’s have a look at that database, the other half of WordPress under the hood. So here’s phpMyAdmin. This is a free and open source application as well, but it’s not installed on your computer. This is actually installed on your web host. Most web hosts let you have access to their phpMyAdmin application so that if you have to do any work on the database, you can do that through phpMyAdmin. Now, I don’t record When you doing any of that kind of work unless you are comfortable with working on a database, and it’s certainly recommended that you have a backup just in case something goes wrong. Now, what does a database do and WordPress database stores data, what is data data is the content that you create in your pages and posts and custom post types. But it’s more than that. It’s more than just the metadata. It’s more than what you can fake. It’s all the settings that are unique to your site, that are stored in a database, and the reason why they’re stored in the database so that they can be reused. But I’m just going to show you a little sampling of what the database does. And for this, I’m going to go over here to this database over here. Now this is that DB df. Remember, I said well, we have to keep that in mind. I want to make sure I’m in the right database. I’m going to click on that. And what I get here are all the data tables that make up the database. So in WordPress, we get 11 data tables out of the box. So you install WordPress it’s fresh, you get a look at it 11 data tables, why do I have more than 11. Some plugins when they’re installed in use, they create their own data tables to work alongside the 11 default WordPress data tables. What I want to show you next is the fact that each one of these data tables has a prefix that five, a four, okay underscore five a four underscore perfect, that matches exactly what we saw in the WP config file. And the last thing I want to show you is this right over here, the options table. This is really important. It’s here where the site URL and homepage URL are stored. And I actually could change that I’m not going to do it. But any one of these values can be changed in the database itself. Like I said, I don’t recommend working on anything like this unless you have a backup and become familiar with how to do it. And that’s WordPress under the hood, two very different components. One deals with files and folders that you access using an FTP client like file Zilla, the others the database itself, which is not a file, but is where the text based data of your website is located and could be accessed using phpMyAdmin. I hope you found this helpful.

  • Length 12 mins
  • Language English
  • Subtitles English
  • Transcript View

You must agree to our Code of Conduct in order to participate.


Presenters

Bud Kraus
@trynet

I’m a WordPress Instructor and Site Developer based in the NYC area. I’ve been using WP since 2009. I’ve attended and spoken at many WordCamps. For more videos to help you learn WordPress see https://joyofwp.com.