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.

Read more here: Adding metabox to wordpress plugins menu page

Leave a Reply

Your email address will not be published. Required fields are marked *