Opened 9 years ago
Closed 7 years ago
#37237 closed defect (bug) (worksforme)
rewrite rules for hierarchical custom posts seem wrong
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.5.3 |
| Component: | Rewrite Rules | Keywords: | reporter-feedback |
| Focuses: | Cc: |
Description
I have a custom post that is non-hierarchical. It generates permalinks as expected:
mydomain.com/abcd/post-name
The corresponding rewrite rules seem correct as everything works just fine.
Part of the arguments that I am using for register_post_type:
'hierarchical' => false,
'supports' => array(
'title',
'editor',
'revisions',
'thumbnail',
'page-attributes'
),
'rewrite' => array(
'slug' => '/abcd',
'with_front' => false,
'feeds' => false,
'pages'=> false
),
Setting 'hierarchical' to true and regenerating the rewrite rules results in permalinks as expected:
mydomain.com/abcd/post-name
mydomain.com/abcd/post-name/child-post
But: the rewrite rules that are generated do not work with this permalink structure.
I would expect that the rewrite rules that WordPress generates match the permalink structure that WordPress generates. Or is that too easy?
If needed I can provide the rewrite rules that are being generated in both cases.
Hi @realblueorange,
Thanks for this ticket! My apologies that it took so long to receive a response.
I have done some testing, and I am unable to reproduce the issue you are describing. If I switch your to hierarchical post type, flush rewrite rules, the post correctly shows at
/abcd/parent-post/child-post.I am going to close this out as
worksforme, but if you are still experiencing this issue, please reopen with more details. What your permalink structure is in Settings > Permalinks would be helpful (I assumed and tested with/%postname%/based on your description).