Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
SQL to Update Custom Field
Lab: Introduction to Databases
Video Runtime: 05:14
Up until now, you’ve been getting data out of the database. It’s time to update data in the database. You’ll learn about how to update custom fields in the wp_postmeta
database table both by writing the native SQL and using update function from WordPress Core.
First, let’s write the SQL to change the custom field’s value in the database. You’ll learn about the UPDATE
keyword in SQL.
Then let’s update the subtitle using update_post_meta()
. When you run the following code, the subtitle changes and then renders out to the browser. You’ll look at the SQL queries WordPress generates via the plugin, Query Monitor.
Hey... hey you... yes you!... Having a good time? Learning new things? Good!
Episodes
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