Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Exclude Pages from the Menu in WordPress

Last updated on by
Elegant Themes
How to Exclude Pages from the Menu in WordPress

Often bloggers need to create pages in their blog, but they do not want to display them in the menu. In this article we show you how to exclude pages from the menu in WordPress. This question was asked on our twitter profile.

Most of the time the menu is located in your sidebar.php but it can be located in other files. Open that file and locate the following code:

<?php wp_list_pages();?>

Replace the following code with:

<?php wp_list_pages('exclude=12,14' ); ?>

Now you can change the number to the page ID and that page will not be displayed in the menu. For more details see WordPress codex

There is also a plugin that allows you to do this. It is called Exclude Pages.

If you have a question, use our twitter profile to ask it. We answer all questions :)


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »