How To Manage Pages In WordPress Menu

How To Exclude Pages From WordPress Menus

In WordPress, we deal with managing pages in the WordPress menu. Sometimes we want to keep the page but do not want them to appear in the main menu. This section will discuss How To Exclude Pages From WordPress Menus.

For excluding the page from the menu in WordPress, we can either use the code solution method or the plugin method given below.

Let’s discuss them briefly.

method 1: Excluding page by code solution

In WordPress, you can easily exclude pages from WordPress menus by editing code.
The code line you will require to edit is located in the sidebar.php file, but it may present in other files also.

Navigate to Appearance >> Editor to access the sidebar.php file.

On the next page, you can access the sidebar.php file. Go to the file and find the code:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]
<?php wp_list_pages();?>

After finding the code, Replace the code with the following code, and save your settings.

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]
<?php wp_list_pages(‘exclude=7,17’ ); ?>

Note: The ID numbers in the code are page ID numbers 7 and 17.
To exclude the pages from your WordPress menu, You can replace the above page ID numbers with the page ID number you want to exclude.

method 2: Excluding pages by the plugin

The other method to exclude pages from the WordPress menu is to use the plugin. 

Exclude Pages From Menu Plugin.

Exclude Pages From Menu Plugin gives an option in the page editor screen in the admin area. 

From the dashboard, install and activate the plugin.

Go to plugins >> add new>> search Exclude Pages From Menu >> Install >>Activate.

After Activation, you need not do anything. The setup is done automatically. 

The plugin adds a check box- the “Exclude pages from the menu” box in the page editor screen.

Go to the page you want to exclude and tick the check box. 

To sum up, In WordPress, while managing pages we need to Exclude Pages From WordPress Menus. As you notice, both options provide a simple and quick way to exclude pages from WordPress menus. You can try any method to exclude the pages. 

You can also check our another post on how to exclude pages from WordPress search results.

Leave a Comment