[wp-trac] [WordPress Trac] #13490: Permalinks Issues for Custom Post Types with Parents

WordPress Trac wp-trac at lists.automattic.com
Sat May 22 06:54:54 UTC 2010


#13490: Permalinks Issues for Custom Post Types with Parents
--------------------------+-------------------------------------------------
 Reporter:  mikeschinkel  |       Owner:                   
     Type:  defect (bug)  |      Status:  new              
 Priority:  normal        |   Milestone:  Unassigned       
Component:  Post Types    |     Version:  3.0              
 Severity:  normal        |    Keywords:  reporter-feedback
--------------------------+-------------------------------------------------
Changes (by dd32):

  * keywords:  => reporter-feedback
  * version:  => 3.0
  * component:  General => Post Types


Comment:

 > When a custom post type is assigned a value for post_parent via a custom
 metabox then it's permalink fails because the rewrite rules for
 register_post_type() don't allow paths longer than two segments.

 If you set it to be hierarchical, then it should allow an unlimited path
 length, the same as pages, the only catch being it must be /<rewrite
 slug>/../../../../../ etc.

 After registering a post type, you need to flush the rewrite rules in
 order for the new rules to take effect, This is probably whats caught you,
 you've set it up first without the hierarchical flag set, then changed it,
 which has enabled the UI, but the rules are still only for non-
 hierarchical.

 For the rest of restaurant-locations vs restaurants, I dont fully
 understand, To me it sounds like you want to have the latter as child
 "pages" of the location? If so, thats fully supported -as the same post
 type-, If you want them to be different post types, you need to handle the
 permalinks yourself, through add_rewrite_rule(), as the post type URL
 rewriting only handles the basic /slug/...../ permastructure, nothing
 fancy, But WordPress has nothing stoping you from using something fancy,
 you just need to write the rule yourself.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13490#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list