18 Oct Beginners Guide to WordPress Internal Structure
We all use WordPress, we love it, but do we actually know how it works? The great thing about taking a look at the cogs that are turning beneath the service is that you’ll gain fresh insight into what you can use it for.
Get 20% off - The Most trusted Theme brand in the World
The only difficulty is knowing where to start. Well, luckily for you I’ve put together a beginners guide that’s going to make things simple and straightforward. Turn your phone off for 10 minutes, get out a pen and paper, and take a look at the amazing world of WordPress.
The WordPress Directory Structure: The Mechanisms That Make it Work
The first thing that we need to look at is the directory structure. Let’s open up WordPress so that you can take a look at what I’m talking about. When you have the directory folders laid out in front of you it’ll be so much easier to get to grips with things. Here’s what you need to do:
- Open the cPanel file manager that is provided by your hosting service
- Use a file transfer protocol (FTP) client which will show you the same things
Next you’ll see the main folder that contains everything else: public_html. This is the real core of the directories, files, and folders. It contains things such as:
- and the list goes on and on
If you want to see a comprehensive list this is where you can see all of the WordPress core files. There’s no need to memorize the names or anything like that. But a quick skim down the list will enable you to gain some insight into just how much is going on.
They do all manner of things that keep your WordPress site in good health so that you can keep building it. Here’s a couple of good examples that will show you just how much is going on in the background:
- index.php: Controls the base configuration and MySQL settings so that you can create databases
- .htaccess: Allows WordPress to access files, folders, and permanent link structures
Now that we’ve talked about that we can take a look at the next level of complexity: the trio of core files. Once we’re done with them, we’ll take a look at themes and some clever plugins that allow you to do things like change fonts easily.
Core Files and Folders: What Do They Really Do?
Located inside public_html there are three files that are essential to know about if you want to really get to grips with things. We’ll look in a little more detail at these three so that you can see what they do.
- wp-content folder
This is quite an interesting starting point because it’s where WordPress stores all of the plugins and themes that you need to make your site function and look good.
The specific contents of it will vary depending on the exact nature of your site which makes sense when you consider what it is for. There would be no use in it storing every plugin and theme available, it only needs to hold what you use.
In addition it will also hold PHP files and any uploads that you decide to make. This makes it very much the workhorse folder in the WordPress world.
- wp-includes folder
Next up we have what many people will say is the most important folder of the three. The key point is that it contains most of the core files WordPress uses to function. You can think of it as the brains behind the scenes because of the firepower that it contains.
functions.php is a great example of what I’m talking about. It contains so many functions that if it were missing then your initial installation wouldn’t wprk at all. Here’s a couple of others that you need to know about:
- cache.php: Allows you to add and subtract from the cache so that you can access it far faster than you otherwise would be able to
- version.php: Which allows you to see at a glance what version of WordPress you’re running
- wp-admin folder
The use of ‘admin’ alone in the name tells you what this folder is all about. It’s what allows you to grant access to all of your admin tools so that you can put them to work. It can do a whole host of other things such as checking if a user is an admin and grants control to a particular user profile.
Hopefully this little crash course is giving you a better idea about what’s going on. Now let’s move onto plugins and themes…
Plugins and Themes: Some Great Extras You May Not Know About
Firstly you need to open the wp-content folder so that you can see what I’m talking about. There’s a whole host of things in there but we’re just going to look at plugins and themes as they’re the key ones.
Every time you install a theme you get a matching folder added to the back end. Open one of them up and you will see countless PHP files staring back at you. There’s no need to learn what every single one of them does because that could take a lifetime and is beyond the scope of this article.
Any given theme will look the same from the outside but there is a world of difference when you get into things. Every specific difference between themes results from a PHP file behind the scenes. You can edit a file if you want to, but remember that the changes you make will be lost when you update the theme.
- Plugins folder
Every plugin will have its own dedicated subfolder that contains everything that makes it function. It is possible to edit the files that build the plugin, but I’d strongly advice against doing this.
Plugins are a complicated and complex business that is best left to the people who write them. You could easily create a subtle compatibility issue that causes all sorts of problems down the line. If for whatever reason it does happen, disable all of your plugins using FTP and then start from scratch.
Backing Up: Always, Always, Always Backup
If in doubt, backup, backup, and backup again. The key thing to remember about backing up is that you’re not just doing it to avoid being hacked. If your home were flooded for example you’d rue the day that you decided it was sufficient for the only backup to be in your desk drawer next to your laptop. Backup to a separate physical location and you’ll have peace of mind.
Here’s what you need to sort out:
- Core files: It’s a good idea to back these up, but you can always retrieve them from the WordPress website.
- Custom content: the wp-content folder contains all of the images, uploads, and custom themes. If they’re lost then you can’t get them back and you will have to start from scratch so make sure you back it up.
- WordPress database: All of your pages, comments, reviews, and posts are stored here so make sure that you include it in your backup.
- Configuration files: You can always recreate them, but if you want to get back up and running as soon as possible then back them up.
Hopefully this has given you plenty of insight into the wonderful world of WordPress. Give it some thought and you’re sure to get plenty out of it.
ABOUT THE AUTHOR
Steven Mehler holds a degree in Interpersonal Communications and has a background in the IT industry. He has also worked as a writer at TopWritersReview for the past 5 years. His passions include: web design, technology trends, and teaching. In his spare time he builds computers and loves to relax with his dog.