Learning WordPress : files and database

There are a numerous blog posts and forum discussion about WordPress.  However you can read all of them back and forward and still not know how the system works.  If you seek the real understanding of WordPress, there are two and two things only that you need to go through : its database scheme and its source code files.  And it’s not as hard as it might seem.

While you can download WordPress source code and go through each file using your preferred text editor or programming IDE, that might not be the best of fastest way to learn it.  Instead, I’d recommend a web-based interface available at PHPXref.com .  It might not necessarily have the latest version of WordPress, but usually it’s not that far behind.  For example, it currently features WordPress 2.7, with WordPress 2.8.1 being the latest version available for download.

WordPress at PHPXref.com
WordPress at PHPXref.com

The coolest things about such an interface are syntax highlighting and cross-reference within WordPress source code, as well as links to PHP manual for native functions.

WordPress database scheme (ERD)
WordPress database scheme (ERD)

As for the database, you have three things going for you here.  Firstly, WordPress database scheme is very small, simple and straightforward. It’s only 10 tables with just a few fields each.  Secondly, it’s very well documented.  And thirdly, when you do a fresh installation of WordPress, you have some sample data in your database, which helps to understand what goes where.  You’ll find one post and one page (to see the difference), one comment (to see how those are linked to posts), one category, one user, and a few links in the blogroll.  Just inspecting that fresh database will clear up your head and sort things out.

Spending a few minutes going through the source code and understanding the database scheme is very worth it.  Firstly, you’ll better understand what WordPress can and cannot do.  Secondly, you’ll get inspired (that I can pretty much guarantee you).  Thirdly, you will automatically get the understanding of how almost each and every WordPress plugin works.  Not in details, but you’ll be able to reverse engineer them in your head easily.  And fourthly, you’ll become much more efficient with WordPress customizations – you’ll just know where to put things and how to better change stuff.

Leave a Comment