Community
Community

Reputation: 5072

WordPress: How to show a metabox on any admin page?

I already know how to register metaboxes for Posts, Page, and Custom Post Types, but I would like to register a metabox to be shown on my custom admin page, which is not a post.

My plugin has an "Options Page" in the WordPress Admin – I would like to show metaboxes on this very page.

Is this possible? If yes, how can this be acheived?

I saw in the add_meta_box documentation that one of the possible values for the $post_type parameter is dashboard, however this is not documented anywhere. I guess it would show the metabox on the WordPress Dashboard (the main admin screen when logging-in), but this is not what I need or want.

Edit:

This question is about OptionTree Metaboxes, which uses the standard WordPress Metaboxes. Perhaps there is a better way to accomplish this by using OptionTree differently, or by modifying OptionTree? Please see this related question: How to have more than one "Theme Options" page with OptionTree?

Upvotes: 4

Views: 2796

Answers (2)

Manish
Manish

Reputation: 193

Never tried but just an idea. In your plugins options page url pass another parameter say post-type and provide any new post type name. Then use this parameter value in add_meta_box() function $post_type = $_GET['post_type'].

Upvotes: 0

Jothi Kannan
Jothi Kannan

Reputation: 3358

if my understanding is right you can do it by following

Here is a Demo plugin that can help you get it working.

This WordPress Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine

Upvotes: 2

Related Questions