[wp-trac] [WordPress Trac] #18040: Turning on permalinks, CPT rewrites are ignored

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 8 18:11:01 UTC 2011


#18040: Turning on permalinks, CPT rewrites are ignored
--------------------------+--------------------------
 Reporter:  andy          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.2.1
Component:  Post Types    |    Version:  3.2
 Severity:  normal        |   Keywords:  dev-feedback
--------------------------+--------------------------
 I'm working on rewrite issues in a plugin that registers custom post
 types. Everything works perfectly if rewrite rules already exist. However,
 when switching away from the default permalinks (?p=123), no CPT rewrite
 rules are added. I have to trigger another flush (e.g. by reloading the
 Permalink Settings page) before the CPT rules appear and my plugin's URLs
 work.

 This bug is due to [http://core.trac.wordpress.org/browser/trunk/wp-
 includes/post.php?rev=18367#L988 this check]. When switching from no
 permalink_structure to some permalink_structure, the empty
 permalink_structure option prevents the rewrite rules and permastructs
 being added, even though they should be allowed in this case. The result
 is that the rewrite_rules are generated without any CPT rules.

 I suppose the option check is purely for performance reasons. The simplest
 fix would be to omit the option check which would cause register_post_type
 to take a little bit longer than necessary on sites without a permalink
 structure. If this is unacceptable, the fix can ignore the option when
 is_admin() (or some other test).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18040>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list