[Snippet] WordPress: How to use add_meta_box

The add_meta_box() function was introduced in Version 2.5. It allows plugin developers to add meta boxes to the administrative interface.

For example, you want to add a new field for Post such as City. User need to choose City for the post before publish it. We can use add_meta_box to add a new graphical user interface for meta box.


You may add this code snippet in your current active theme functions.php file or create a custom plugin.

Modify the code snippet above as what you need.