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.
Tutorials
- 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.
GitHub Repositories
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.
2 Responses
Thanks for this article Jean,
I have bookmarked it and I will evaluate given resources to find out which one can work better for me.
Just to share my experience, I have used Meta box Plugin by Rilwis in my projects ( by embedding it as part of theme ) and found it working reasonably good.
Let me know if you tried that and what you think about it OR any better resource than Rilwis meta box plugin.
Thanks again.
I use Jared Athisonβs Custom Meta Boxes and Fields class all the time. The fact that it was built by some of the best WP Developers around made me try it and I haven’t looked back.
The code is solid and setting it up is crazy easy. Drop it in your plugin, create some boxes, and you’re good to go.