WordPress template hierarchy when subpages not defined

Example site(mysite.com) and page defined with wordpress as mysite.com/mypage

This page goes through template page-mypage.php. Now when I run mysite.com/mypage/somechild where somechild page is not defined with wordpress. This causes Not found error(404).

Read More

How do I make mysite.com/mypage/*/* go through template page-mypage.php ?

Related posts

2 comments

  1. wordpress is not slug base templating, please check

    https://developer.wordpress.org/files/2014/10/template-hierarchy.png

    assuming you have a page called mypage, it will use if exists

    custom-template-you-define.php //if doesn't exist it will look for 
    page-[slug].php // if doesn't exist it will look for 
    page-[id].php // if doesn't exist it will look for 
    page.php // if doesn't exist it will look for 
    singular.php //if doesn't exist it will look for 
    index.php //if doesn't exist White Screen
    

    and if you create another page called somechild assign as child page, the same method applies to this page.

  2. You must select the same page template for child pages too. Make sure you have done that.

Comments are closed.