woocommerce – How can I replace the submenu page of a plugin and keep the same slugs?

I have a plugin and I would like to change the reminder function of an admin submenu page in order to be able to change the output.

This is what I have had so far (in a functions.php file):

add_action (& # 39; admin_menu & # 39 ;, & quot; replace_submenu_page & # 39 ;, 50); // The command of the original action is 49
replace_submenu_page () {function
remove_submenu_page (& quot; edit.php? post_type = wc_booking & # 39 ;, & quot; booking_calendar & quot;);
add_submenu_page ("edit.php? post_type = wc_booking", __ ("Calendar", "woocommerce-bookings"), __ (& # 39; Calendar & # 39; calendar & # 39; , "Woocommerce-bookings", "manage_bookings", "booking_calendar", "new_callback",;
}

function new_callback () {
echo "test";
}

I think this will produce a page with only test printed on it. However, it takes out the contents of the original function followed by test from my new_callback a function.

In addition, if I delete the add_submenu_page call above, it only removes the menu link and I can still access the page via the URL.

Can any one help me find what I miss?
I would like to completely replace this page using the same menu_slug and parent_slug so that I modify as little as possible the functionality of the plugin.

The plugin I'm testing is Woocommerce Bookings, but I've encountered this problem while using other plugins.