Currently I am trying to add a page as a child in my custom post section. The parent pages in my custom posts works correctly, I've set a template file for them as singe-custom_post_name.php. All good. Now I have added support to create child pages, I am able to create those pages in my custom post type section but when I navigate to the url a template couldn't be found.
What are the possible problems or solutions to this kind of problem? As far I don't understand where this problem is coming from but I guess there should be something to do with he slug?
domain/%custom_post_title%/ works
domain/%custom_post_title%/%child_title%/ template not found..
Any feedback is welcome, hope we get this issue solved, thanks!
Currently I am trying to add a page as a child in my custom post section. The parent pages in my custom posts works correctly, I've set a template file for them as singe-custom_post_name.php. All good. Now I have added support to create child pages, I am able to create those pages in my custom post type section but when I navigate to the url a template couldn't be found.
What are the possible problems or solutions to this kind of problem? As far I don't understand where this problem is coming from but I guess there should be something to do with he slug?
domain/%custom_post_title%/ works
domain/%custom_post_title%/%child_title%/ template not found..
Any feedback is welcome, hope we get this issue solved, thanks!
Share Improve this question asked Jan 29, 2016 at 11:35 FreshteaFreshtea 1632 silver badges8 bronze badges1 Answer
Reset to default 1It turns out the Wordpress permalink structure works perfectly well for custom types, e.g. example/recipes/lunch/sandwich/. This works exactly as expected if you set 'hierarchical' => true.
What I was originally trying to do was unnecessarily difficult to execute, and requires properly setting up a custom permalink structure to avoid 404 errors. I advise you stick with the standard Wordpress hierarchical permalink functionality.