Make WordPress Core

Opened 8 years ago

Closed 5 years ago

#37237 closed defect (bug) (worksforme)

rewrite rules for hierarchical custom posts seem wrong

Reported by: realblueorange's profile realblueorange Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Rewrite Rules Keywords: reporter-feedback
Focuses: Cc:


I have a custom post that is non-hierarchical. It generates permalinks as expected:

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(
'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:

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.

Change History (1)

#1 @desrosj
5 years ago

  • Keywords reporter-feedback added
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.