Adding Meta Boxes to Post Types in WordPress
read more
Categories

Adding Meta Boxes to Post Types in WordPress


If you’ve ever used WordPress to build a website for yourself or a client, or you work for a company whose website is powered by WordPress, you would have seen and used meta boxes.

In the past, we’ve covered adding custom meta boxes to WordPress. In this article, we’ll go two steps further explaining their relationship and integration with post types, including how to use the data saved in a meta box in the WordPress front-end.

Adding Meta Boxes to Post Types Screen

More from this author Understanding Namespaces in the WordPress Hook System Alternative Ways of Triggering Events in WordPress Most (if not all) of the PHP functions, their parameters and Action hooks that are handy in creating meta boxes have been covered by Narayan Prusty.

To add a meta box to the any post type editing screen, the add_meta_box() is used and subsequently hooked to the add_meta_boxes action.

The code below adds a metabox to the post edit