Let's suppose a Custom Post Type called "Whatever", which will have a root slug set to "whatever".
This makes all posts of type "whatever" be available at
I also want a parent page called Whatever to be available at
To achieve that, I must create the page with said slug and also set the
has_archive property to false, when registering the "Whatever" CPT.
So far so good.
Now, I want to have some specific child pages for the page "Whatever", and I want them to be available at
This last step is not working because when accessing that url, WordPress tries to load a CPT of type "Whatever" with name "child-page-name". And it does not exist.
What I want to do is to prioritize pages during the loading process, so that if a child page of "Whatever" exists with the requested name, it should always be loaded (even if a CPT exists with said name).
I don't know where to start. I thought about having the single-whatever.php file look for a page with the requested post name. But, I don't know what to do with that information if the page exists. Should I redirect? Filter the loaded template? Here is where I am stuck, and any help will be appreciated.