#1790
Vladimir
Keymaster

This code removes items from the list of parent pages at the ‘Page Attributes’ meta box placed to the right at the page editor screen. It does not related to any ‘main menu’.

If you name ‘main menu’ the menu to the left at the WordPress wp-admin, then use ‘Admin menu’ access add-on to block/hide that menu items from users:
https://www.role-editor.com/block-admin-menu-items
You don’t need any additional code for that.

If you write about some other menu, please clarify what menu do you mean.