2

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.com/%custom_post_title%/ works
domain.com/%custom_post_title%/%child_title%/ template not found..

Any feedback is welcome, hope we get this issue solved, thanks!

1 Answer 1

1

It turns out the Wordpress permalink structure works perfectly well for custom types, e.g. example.com/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.

1
  • I wish, but this website has already been online since a while and I just dropped into the project. Changing those urls are not directly an option.
    – Freshtea
    Commented Feb 1, 2016 at 23:10

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.