0

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 !

1
  • WordPress doesn't have breadcrumbs functionality out of the box, how are you displaying breadcrumbs?
    – Tom J Nowell
    Commented Jun 16, 2021 at 14:00

2 Answers 2

0

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(){
  if(is_page_template('template-redirect-home.php')){
    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.

0

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.

1
  • Hi, thank's for your answer. I use Rank Math SEO breadcrumbs. I don't think I can change that in the settings. I should try to do a function myself.
    – popcorn
    Commented Jun 18, 2021 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.