[wp-trac] [WordPress Trac] #13022: Pretty Permalinks not working with custom post type

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 16 19:17:26 UTC 2010


#13022: Pretty Permalinks not working with custom post type
--------------------------+-------------------------------------------------
 Reporter:  bigdawggi     |       Owner:  ryan                                            
     Type:  defect (bug)  |      Status:  new                                             
 Priority:  normal        |   Milestone:  Unassigned                                      
Component:  Permalinks    |     Version:  3.0                                             
 Severity:  major         |    Keywords:  permalinks, rewrite, custom post type, post type
--------------------------+-------------------------------------------------

Comment(by bigdawggi):

 For what it's worth, indeed calling "   flush_rewrite_rules();" after the
 registering of a new post type works great.  Now to figure out how to make
 it scalable.

 oh, and sorry for the lack of formatting in last post, here's the lists:
   So the process to make it work is:
   1. define custom post type
   1. visit permalinks settings page (which flushes the rewrite rules) --
 don't even need to change or re-save the permalink settings
   1. go add posts with custom post type

   Potential Resolution:
   1. register_post_type() checks a "registered_post_types" array in the
 options table for its post type.
   1. If that post type does *not* exist in the array, then flush rewrite
 rules, and add that custom post type to the array.
   1. do some sort of "cleanup" of the "registered_post_types" array via
 cron ???

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


More information about the wp-trac mailing list