30% Discount Get your Kallyas WordPress license Today for only $49! Or renew your support at $18 for extra 6 months. Shop Now

Add custom link to menu to logged in users only

This article will show you how to add a custom menu item to an existent nav menu.

In this example, I will add a link to My Account page to display to logged in users only.

Before we get to the code, you will need to go to Appearance > Menu and create a new menu. Call it: top nav.

Next, assign that menu to Header Navigation ( Top Bar ) location.

Now add the below code snippet to your child theme’s functions.php file:

Go to Appearance > Themes and activate the child theme. Now, the link to the My Account page will be displayed in the header.