Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Update an Existing Custom Field
Lab: WordPress Post Metadata (Custom Fields) Basics
Video Runtime: 17:15
Let’s update an existing custom field, which is a post metadata, in the database. You’ll use update_post_meta()
and walk through using it. You’ll see what it does in the database, how to use it, what the different arguments do, and even peak into WordPress Core.
This function does multiple tasks:
- If the post metadata exists, it updates the
meta_value
WHEN'unique'
is set tofalse
.- OR
'unique'
is set totrue
and the existingmeta_value
matches what you pass in as theprevious
argument.
- If the post metadata doesn’t exist, then it adds it into the database.
So this function can update as well as add a new one. Cool. Come do this episode with me to dive into it and understand how to use it.
Hands off the keyboard. Web development starts by thinking first, then planning it out, and then coding it.
Episodes
Total Lab Runtime: 02:03:31
- 1 Lab Introductionfree 09:52
- 2 What is a Custom Field?free 15:55
- 3 What is a Meta Box?free 06:24
- 4 Project: Add a Subtitlepro 07:16
- 5 The Databasepro 11:48
- 6 Get Subtitle Post Metadatapro 15:26
- 7 Add Subtitle to Genesis Themepro 12:19
- 8 Update an Existing Custom Fieldpro 17:15
- 9 Add a New Custom Fieldpro 07:19
- 10 Delete a Custom Fieldpro 10:13
- 11 More Custom Field Functionspro 06:25
- 12 Wrap it Upfree 03:19