Adding metabox to wordpress plugins menu page

Now I am building a wordpress plugin. I need to add a metabox to the admin submenu page. I tried like this below,

add_action( 'add_meta_boxes', 'add_meta_boxs');
function add_meta_boxs()
{
    add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'meta_box', 'myContactForm', 'normal', 'high' );
}

I created a submenu page:

add_submenu_page( 'myForm',  'Add New' , 'Add New', 'manage_options', 'newForm', 'newform_page');

function newform_page()
    {
       div class="form-container-2"
        ?php do_meta_boxes('myContactForm', 'normal', null); ?
        /div
    }

Here "myContactForm" is a custom post type. Meta box was created in custom post type but what I need is meta box will be created within submenu page.

Anyone help me please.

Topic metabox Wordpress

Category Web


Meta box are designed to work with Post(s) and Custom post types.

However you can make it work on options page if you know what you are doing.

Click here for sample code

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.