If you want to exclude your pages from your navigation menu, you can use the Exclude Pages plugin.
However, this article will discuss on how to exclude your pages from your navigation menu by making changes to your coding in your header.php file. This involves additional steps as compared with using the simple Exclude Pages plugin.
Below are the steps to hide page links from your navigation menu:
1. Determine and write down the ID of the page that you want to exclude from your navigation menu. Learn how to get the post or page IDs here.
2. Go to Appearance / Editor and open the header.php file and look for the following codes:
<?php $children = wp_list_pages(’sort_column=menu_order&depth=1&title_li=’);?>
3. Add the following codes (in bold) and page IDs (in bold) that you want to exclude from the navigation menu as follows:
<?php $children = wp_list_pages(’sort_column=menu_order&depth=1&title_li=&exclude=1,2,3‘);?>
Note: The page IDs 1, 2,3 is for illustration only.
Header.php codes in different themes may be different. Below is another example:
<?php wp_list_pages(‘title_li=’); ?>
After making changes to exclude the pages, it will look like this:
<?php wp_list_pages(‘title_li=&exclude=1,2,3‘); ?>
I hope the above tip is useful if you prefer coding rather than using a plugin.