admin管理员组文章数量:1291105
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 !
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 !
Share Improve this question asked Jun 16, 2021 at 13:26 popcornpopcorn 32 bronze badges 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
Reset to default 0Just 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.
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.
本文标签: privateHow to hide a page in wordpress made for menu
版权声明:本文标题:private - How to hide a page in wordpress made for menu 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741500126a2382018.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论