Adding Meta Box to Specific Submenu Page

Question

I’ve created this page:

function wpdocs_register_my_setting() {
    add_submenu_page(
        'edit.php?post_type=task',
        'View Tasks',
        'View Tasks',
        'manage_options',
        'view-tasks',
        'view_tasks_submenu_page_callback'
    );
}

function view_tasks_submenu_page_callback() {
    // html
}
add_action( 'admin_menu', 'wpdocs_register_my_setting' );

And I want to add a meta box to this page only.

function cd_meta_box_add() {
    add_meta_box( 'in-progress-metabox', 'In Progress', 'render_task_in_progress_metabox', 'task', 'normal', 'high' );
}
function render_task_in_progress_metabox() {
    // html
}
add_action( 'add_meta_boxes', 'cd_meta_box_add' );

But I cannot seem to find the correct answer for this. Again, I only want to add this meta box to this specific page. I’ve seen people talk about needing to use do_meta_boxes but it doesn’t really make sense.

0
, , dcolumbus 3 years 2020-07-05T06:11:34-05:00 0 Answers 67 views 0

Leave an answer

Browse
Browse