How WordPress Works

wp-orange-640x960You probably use it every day, but do you really know how it works?

Once you have a basic understanding of the relationship between the various parts that make up WordPress, you’ll be much more confident in your work. Suddenly, changing a widget or updating your theme won’t seem so scary.

What you really need to know about how WordPress works is this: it’s made up of three distinct parts, each of which is completely independent of the others.

WordPress Core Files

The WordPress core consists of roughly 1,000 individual files. It’s what you download when you visit WordPress.org (if you’re doing a manual installation) and what Fantastico and other auto-installers add to your web server if you choose that method.

The core files are stored in two main folders, wp-admin and wp-includes, with a handful of files residing in your root directory as well. The file named wp-content also comes with WordPress, and is the future home of your plugins, themes, photos, and anything else you upload via the media uploader.

These are the files that run your website.

Theme and Plugin Files

As we said, whenever you add a theme or plugin to your site, WordPress stores it in the appropriate folder inside wp-content. The same is true for any images, PDF files, video or audio you upload via the WordPress media uploader. These files are generally stored in folders organized by date.

WordPress Database

Here’s where it gets confusing for some people. All those 1,000+ files we just talked about, plus all your themes and plugins? Not one of them contains a single blog post, contact form, or “About Me” page. In fact, if you ever need to “clean” a hacked WordPress site, you can safely delete every single file that comes with WordPress, with the exception of wp-config.php and the uploads folder. Everything else is easily replaceable just by uploading a fresh copy of the WordPress core.

All of your words, category choices, comments, tags, widget content, and a lot of other information are stored in the database. Every time someone views a page or post on your site, WordPress searches the database for the required content, and presents it to the viewer. Images are stored as links only, so WordPress knows where to look for the correct file.

What Does This Mean for You?

What it means primarily is that you can change themes without risk of losing content. You might have to rearrange your widgets, but all your posts and images and page content will still be right where you left it. Think of it as wallpapering your bedroom. Your furniture doesn’t change, just the color on the walls does.

It also means that if you’re building a new theme, you don’t have to do so on a live site. Instead, you can do it on a development site, then when you’re happy with the look, simply zip the theme files only, and upload them to your live site just as you would any other theme.

Furthermore, if you have trouble with your plugins, you can (almost always) simply delete them and upload new versions. Plugin settings are frequently stored in the database as well, so you often won’t even lose your presets.

Finally, it means that when you back up your site (you do back up, right?) you have to back up both parts – the files and the database. One without the other is useless. I use and recommend BackupBuddy, which handles both with ease.

Still confused about how WordPress works? Post your questions in the comments and I’ll see if I can clarify it for you.


Comments

  1. says

    One thing that confused me is Child Themes and I guess they’re called Parent Themes. Like Genesis. The other day I realized comments weren’t working on my site and finally figured out that it was the settings in the Parent theme, which had never occurred to me. So much to learn!

Leave a Reply

Your email address will not be published. Required fields are marked *