WordPress was first developed in 2003 and was created primarily as blogging software. By the release of version 3.5, the image of WordPress had changed from blogging software to a versatile CMS and the word “blog” was actually removed from the description of the software and most places in the source code. Today, WordPress has evolved to become the largest platform on the web and is used on about 30% of all websites on the internet. This is pretty amazing if you think about it. More than a half a billion internet websites run on top of WordPress.
WordPress has gained so much popularity over the years for a couple of reasons. The first is that WordPress is open source software and has an entire community of people invested in improving it and continually contributing new code to extend its functionality. WordPress users, developers, and designers are always thinking of new creative ways to use WordPress and creating plugins for these new features, which can be made available to the community.
Another reason that WordPress has been so successful is the fact that it’s an extremely flexible CMS laced with hooks and filters so plugin and theme developers can have almost total control to build all different kinds of websites. Developers are constantly exploring innovative new ways to use the software, including building web and mobile applications, which is the focus of this blog. The use of hooks and filters is covered later in this article.
Note
We are going to assume that you already know how to use WordPress and have already installed the latest version. If this is your first time using WordPress, check out the WordPress home page to familiarize yourself with it.
Let’s take a quick top-level look at the folders and files that are included within a typical WordPress install.
Root Directory
In the root directory, there are a few core WordPress files. Unless you are digging around in the core WordPress code looking for hooks to use or trying to learn how certain functionality is coded, the only core WordPress file you may need to ever access is wp-config.php. You should never, ever, ever, ever1 alter any other core WordPress files. Hacking core files is a bad idea because upgrading to a new version of WordPress will override your changes. The only directory you should need to interact with is wp-content because it contains your plugins, themes, and uploaded files.
Any time you find yourself wanting to hack a core WordPress file, think again. There is probably a hook or filter you could use to accomplish the same goal. If there isn’t a hook or filter available to do what you need, add one and request to have it added to the core. The core WordPress developers are very responsive about adding in new hooks and filters.
There is one more file you may need to update in the WordPress root directory, depending on your setup and how you are using WordPress: the .htaccess file. It’s not a WordPress core file, but an Apache file WordPress uses to handle directory configuration, permalinks, and redirects. This file is not there by default; it’s created by WordPress automatically the first time you define your permalink structure. Check out all the .htaccess configuration options at your leisure on WordPress’s htaccess Support page.
/wp-admin
This directory contains core directories and files for managing the WordPress admin dashboard interface. A key file in this directory is admin-ajax.php, which all Ajax requests should be run through. We cover Ajax in THIS Article.
/wp-content
This directory is where WordPress users and developers can make WordPress do whatever they want. It contains subdirectories for the plugins and themes you have installed on your website as well as any media files you upload to your website.
The wp-content directory includes several subdirectories, as described next.
/wp-content/plugins
Any WordPress plugin you install on your WordPress site will be located in this directory. By default, WordPress comes with the Hello Dolly and Akismet plugins.
Hello Dolly is included as a quick example of how a basic WordPress plugin is set up. The plugin itself just displays a random line from the song “Hello Dolly” in the upper right of the administrator dashboard.
The Akismet plugin helps stop spam comments by checking incoming comments against the database at https://akismet.com. This plugin and service greatly reduce the number of spam comments that make it onto the frontend of your website. The Akismet service is free (or name your own price) for personal use.
/wp-content/uploads
Once you start uploading any photos or files to your media library, you will see this directory being populated with those uploaded files. All uploaded media is stored in the uploads directory. Some plugins will also create a subdirectory in the uploads directory to various files used or managed by the plugin.
/wp-content/mu-plugins
In WordPress, you can force the use of any plugin by creating a mu-plugins directory inside of the wp-content directory. This directory does not exist unless you create it. The “mu” stands for “must use,” and any plugin you put in the mu-plugins folder will automatically run without needing to be manually activated on the admin plugins page. In fact, you won’t even see any must-use plugins listed there.
Must-use plugins are especially useful on multisite installs of WordPress so you can use plugins that your individual network site admins won’t be able to deactivate.
It is a good idea to check for the mu-plugins folder on any existing site you start working on to see whether it contains any plugins, and if so, to determine what they do. So many times we have been debugging an issue and wondering why something unexpected was happening even though we had disabled all of the active plugins, only to find out that there was an overlooked mu-plugin responsible for the issue.