When the screen in the back-end renders, WordPress calls our meta box callback, which we called
render_meta_box. In your code, that function does the following tasks:
- Grabs the metadata out of the database.
- Does processing if you need it.
- Loads our view file, which gets rendered out to the browser.
Make sure you do this episode with me, as I walk through the code, HTML, and thought processes. You’ll see how little code it takes to create the meta box’s HTML.
Keep It Simple, Stupid (KISS) - the best kiss you'll get in 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