Using post metadata, we can add additional information to built-in and custom post types (content). We use this information for specific filtering, querying, grouping, and processing tasks. In the back end, we build metaboxes whose custom fields provide an interface for authors to input the metadata. In this hands-on lab, you will learn the basics of WordPress post metadata and the custom fields you build for their interface.
What You Will Learn
In this hands-on lab, you will be learning about custom fields and post metadata. More specifically, you will learn:
- What custom fields are?
- What’s the difference between metadata and custom field?
- Dive into the database to see the relationship to “post” content.
- Getting, updating, and deleting existing custom fields
- Adding new custom fields
- When to add a new custom field
- What a meta box is
- and more
You need to have a sandbox test site spun up and ready to go. If you need help with it, see the Setting Up Your Sandbox Test Website article in our Help Center. Make sure you turn on the debug mode in your
wp-config.php file. The code is in that same Help Center article.
In order to do this lab, you will need the following:
- A local web server, such as Local by Flywheel, Desktop Server, MAMP, WAMP, VVV, or some other application.
- Your favorite IDE or editor. (Tonya uses PhpStorm.)
- Firefox and/or Google Chrome
When was the last time you got out of your chair and stretched? Just saying…
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
Check out the WordPress Fundamentals Library for more hands-on labs, insights, Docx, and more.
Check out the series page for more labs: WordPress Metadata, Metaboxes, and Custom Fields Series