How to hide page links from theme menu

Most of users use wp_nav_menu to output the menu in a theme, then you could make use of the callback function that is passed in the arguments array.

wp_nav_menu( array( 'fallback_cb' => 'wp_page_menu' ) );

wp_page_menu is the default value for the callback function.

Looking further, wp_page_menu has an exclude key in its arguments array.

wp_page_menu( array( 'exclude' => '' ) );

You can add a filter to it by adding comma separated values to the exclude key in the arguments array.

function my_cb_function( $args ) {
  $args['exclude'] .= '10,20,30' // comma separated IDs
  return $args;
}
add_filter( 'wp_page_menu_args', 'my_cb_function', 999, 1 );