A meta box provides an interface for site owners, author, editors, admins, etc.
to view, add, delete, and edit custom fields (post metadata). In this hands-on coding lab, you will create a meta box from scratch, step-by-step as you learn about the process of building your own meta box interfaces from scratch.
There are 4 necessary components to adding a custom meta box to WordPress:
- View File
In this hands-on coding lab, you will explore each of them as you build a meta box for your subtitle custom field (post metadata).
In order to do this hands-on, you will need to complete the first part of this series:
Code. Eat. Code. Sleep. Dream about Code. Code.
Total Lab Runtime: 02:21:18
- 1 Lab Introductionfree 07:20
- 2 What is a Meta Box?free 07:28
- 3 Add a New Meta Boxpro 11:46
- 4 Meta Box HTMLpro 18:39
- 5 Save Process & $_POSTfree 12:33
- 6 Bail Out if Not Our Meta Boxpro 05:03
- 7 Nonce Security Checkpro 10:16
- 8 On Save - Update or Delete Custom Field?pro 12:03
- 9 Validate & Sanitize BEFORE Updating Databasefree 14:41
- 10 Add Another Custom Fieldpro 08:49
- 11 Making Save Easier with $_POST Keypro 05:32
- 12 Better Saving Strategy for Multiple Custom Fieldspro 14:47
- 13 Changing Where Meta Box Appearspro 06:02
- 14 Passing Arguments to Renderpro 02:18
- 15 Wrap & Making it Reusablepro 04:01
The bulk of the heavy lifting for working with meta boxes can be generated using a reusable module. In this hands-on coding lab, you will convert the meta box plugin you built in the Basics lab, making it configurable and reusable. Build it once. Then reuse it. For each custom meta box, build a configuration and view file. That's it.
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