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

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 16 18:37:08 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):

 Looks like that does work guys!  I thought I had done that a dozen times,
 but must not have ever been in the right order ;)

 So the process to make it work is:
 - define custom post type
 - visit permalinks settings page (which flushes the rewrite rules) --
 don't even need to change or re-save the permalink settings
 - go add posts with custom post type

 Thanks for the help.

 The one issue with flushing rewrite rules each time is that the
 register_post_type function gets ran at 'init'..and so it'd be
 performance-prohibitive to flush the rewrite rules at every time WP spins
 up.

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

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


More information about the wp-trac mailing list