[wp-trac] [WordPress Trac] #15943: Custom Post Type not set after customizing permalinks.

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 4 21:38:15 UTC 2011


#15943: Custom Post Type not set after customizing permalinks.
--------------------------+-----------------------------
 Reporter:  sterlo        |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Future Release
Component:  Multisite     |     Version:  3.0.3
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+-----------------------------

Comment (by sterlo):

 I've attached some of my findings.

 The first set of attachments are just the objects in their entirety.

 The second set of attachments are the diff files between them.

 I'm making some assumptions here.

  1. When you start off - a fresh wordpress install - the WP_Rewrite object
 is at it's smallest.[[BR]]
  So this would be the assumedbase file.

 So if you save multiple times (with the default value selected) or ...
 install a fresh WordPress install and then view the WP_Rewrite object -
 they should be the same.

 The first time you select your custom post type it does some notable
 things:
  1. It sets "permalink_structure"
  2. It sets "rules"
  3. It sets "extra_rules_top"
  4. It sets "extra_permastructs"
  5. It appends to "rewritecode", "rewritereplace", "queryreplace", and it
 sets:
 {{{
 220 +    [date_structure] => /%year%/%monthnum%/%day%
 221 +    [search_structure] => search/%search%
 222 +    [author_structure] => /author/%author%
 223 +    [page_structure] => %pagename%
 }}}

 The SECOND time you save (without selecting any other options on the page
 - just keeping the radio button "as is" and the input value "as is".

 You get the object in 2ndcustomsave.

 This has some interesting bits in it...

  1. This time it added my custom post type and taxonomy to "rules"...
  2. It also did the same for "extra_rules_top"...
  3. It also added structures to "extra_permastructs"..
  4. It did additional appends to "rewritecode", "rewritereplace",
 "queryreplace".

 Now after this (in my testing) it did not alter the object any further -
 regardless of multiple saves with the same values.

 But if I set it back to "default" - you get the object inside of
 "backtodefault".

 The differences between these are the following:
  1. "rules" is now empty
  2. "extra_rules_top" is now empty
  3. It unsets a few flags and then:
 {{{
 264 -    [date_structure] => /%year%/%monthnum%/%day%
 265 -    [search_structure] => search/%search%
 266 -    [author_structure] => /author/%author%
 267 -    [page_structure] => %pagename%
 }}}

 Things to note:
  * "extra_permastructs" still has the custom post type and the taxonomies.

 '''Finally'''

 If you save again - you go back to the first object set that we had
 initially.

 It removes custom post types, taxonomies, rewrite codes, etc.

 Obviously - something is messed up here. I think it goes beyond
 "detecting" the page in the WP_Query object, this has to do with the
 saving processes for WP_Rewrite.

 I will look into this more and hopefully find something.

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


More information about the wp-trac mailing list