This episode is very important. Make sure you get it!
Let’s explore the relationship between WordPress and its database. You’ll look at where the content comes from in the database that populates the back-end interface for a post. You’ll explore each of the columns in
wp_posts, fields in the
wp_postmeta, featured thumbnail image and where it resides, and the author (which relates to the
You’ll learn about the glue that binds pieces of information together, such as post metadata and how these are glued to the associated record in the posts database table. The primary database tables, such as the Posts and Users tables, have a pre-determined structure with set columns. The meta tables allow us to store additional related content. Then the primary key is the glue that binds them together.
You’ll learn about how WordPress sums the number of revisions. You’ll write a SQL query to fetch the revisions too.
|WHERE post_name = '8-revision-v1';|
The key takeaways for this episode and the lab in general are:
- The content lives in the database and not in WordPress.
- The database is what makes the content dynamic (vs. a static website).
- The columns in a record(s) are what populate the content in the back-end and front-end.
- The primary key is the glue that binds related content together.
Your functions are bloated. Put them on a diet. Think "skinny" and "as few lines as possible."
Total Lab Runtime: 02:08:59
- 1 Lab Introductionfree 05:17
- 2 The Big Picturepro 14:35
- 3 Your First SQL Querypro 12:21
- 4 WordPress to Database Relationshippro 20:20
- 5 Filter Content with WHEREpro 08:24
- 6 Table Alias with ASpro 05:08
- 7 Defining Table Structure (Schema)pro 12:17
- 8 Create a New Database Tablepro 10:23
- 9 WordPress Schemapro 05:11
- 10 Exploring WordPress Queries with Query Monitorpro 07:14
- 11 SQL to Get a Custom Fieldpro 16:41
- 12 SQL to Update Custom Fieldpro 05:14
- 13 Wrap it Upfree 05:54