How to add meta boxes to the ‘Add new post’ screen?

Dashboard widgets only go on the dashboard. You can’t put ’em on any other pages, as far as I know.

For a primer on plugin options, see the codex article on creating plugin options pages.

Is there any reason you need to add a widget-style meta box in your settings page? Are you after the drag-and-drop functionality, or the expand-collapse functionality? If so, you might modify your question to ask for those things specifically.

EDIT
What you’re looking for (based on your comments) are called meta boxes, not widgets (it takes a while to learn all the WordPress-specific terminology). There are some easy-to-use WordPress functions for adding meta boxes to the post creation/editing page–you don’t need to create a separate admin page for them.

To actually save the information entered into these boxes, you’ll want to hook into the save_post action.

This is all explained (including a copy/paste example you can play with) in the codex article on the add_meta_box function.

Leave a Comment