How to hide a page in wordpress made for menu

The question:

I’m trying to completely disable access to my parents page menu.
For example, I have a menu made like this :
parent page -> child page 1
-> child page 2

I made a real page for ‘parent page’ because my backend is better organized.
But I don’t want that my customers go to www.mysite/parent-page

I tried to put that page in “private” but then on my breadcrumbs child page 1 I have : “home > parent page(private) > child page 1

I don’t want it to display the private I just want my parent page in 404 if someone tries to go in.

I hope I was clear.
Thank’s !

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Just create a custom template template-redirect-home.php and assign it to that page and redirect to homepage on load with sth like this:

add_action( 'template_redirect', function(){
    wp_safe_redirect( get_home_url(), 301, '');

You can also use Custom links in the menu to not access the page directly from the menu.

Method 2

As you said “I tried to put that page in ‘private’ but then on my breadcrumbs child page 1 I have : home > parent page(private) > child page 1“. So, all you need to do is – Customize your breadcrumb function to hide/remove your parent page from there. WordPress doesn’t have default functionality to show breadcrumb. The breadcrumb must be coming from your theme or plugin. So, you just need to find the function for the breadcrumb and edit/customize it.

If you show me your breadcrumb function, I can help you customize that as required.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment