Here’s some of the best tutorials and resources for building custom meta boxes that I’ve come across in the past two years. I’m posting them here to have a handy reference for all those building plugins and themes.
- Justin Tadlock’s post on Smashing Magazine
This is ideal for beginners as it covers all aspects very clearly, but doesn’t do anything fancy.
- Themefoundation Meta Boxes Guide
Based on Justin’s tutorial and a Github repository by Jared Atchison, amongst others, it goes a bit deeper but is still good for beginners.
There are some excellent GitHub repositories, which are mostly more advanced than the tutorials mentioned above, but can give you some extended functionality and offer more reusability potential.
- Jared Athison’s Custom Meta Boxes and Fields class
Featuring contributions by Bill Erickson and Andrew Norcross (two top WP developers), this is one of the most updated classes you can use. It acts like a framework for building meta boxes in your theme or plugin.
- My WordPress Meta Box class by Bainternet
Very well supported class, updated frequently, a good reference point and can be also implemented into your theme and plugin.
- Reusable Custom WordPress Meta Boxes by Tammy Hart
Originally a tutorial for Tutsplus, the code has since been improved and cleaned up.
I have also referred to this tutorial on Tutsplus in the past, but I wouldn’t recommend it, as it is riddled with some security issues and other bugs. Refer to the improved class by the same author above (Reusable Custom WP Meta Boxes).
You can also take a look at the code of some major plugins that do things right, such as Easy Digital Downloads. Digging into code is often one of the best ways of discovering how to do things, as the code of popular plugins is likely to be frequently updated and of high quality.
If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.