最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Child page in custom post throws 404 page not found

programmeradmin4浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 1

It 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.

发布评论

评论列表(0)

  1. 暂无评论