Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

Add a Private Page to Your Navigation Menu

By default, any pages that you classify as “Private” are not displayed in the menu generated by the wp_list_pages function. In general this is a good idea, but it might be helpful to include the link if the logged in user is able to read private pages. Fortunately, WordPress has a function that will enable us to do exactly that:

<?php // add a private page to your navigation menu
if(current_user_can('read_private_pages')) : ?>

	<li><a href="<?php echo get_permalink(10); ?>">For Authors only</a></li>

<?php endif; ?>

Place this code where you would normally include the wp_list_pages tag and enjoy private-page links displayed in your navigation menus only for those users who are logged in and priviledged enough to see them. The private link will not be displayed for the “ordinary” folk.

Make sure you replace the number “10” in the middle line to match the ID of the private page you would like to include.

Source: WPEngineer