[wp-trac] [WordPress Trac] #13179: Saving a custom post type with post_parent resets to zero

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 29 21:15:12 UTC 2010


#13179: Saving a custom post type with post_parent resets to zero
--------------------------+-------------------------------------------------
 Reporter:  mikeschinkel  |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  3.0       
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 If you set post_parent in code for a custom post type and then edit the
 child if resets the post_parent to zero.

 Use-case: I have a custom post type of "store" and another of "location."
 I have a meta box that allows me to add locations on the store edit page
 and I set the location's post_parent to the post_ID of the store.  All
 works fine until I go to edit a location that has a post_parent set save
 it will wipe the post parent and thus create an orphan.

 (fyi, my locations do not have page-attributes so setting the parent is
 impossible from the location edit UI anyway.)

 While this is not "supported" behavior yet I'd think that saving it should
 not overwrite a value already set. I went through the code and I'm not
 sure how to correct this. It seems that edit ignores what's in the
 database and only goes with what is in $_POST. As such, it might be a
 significant modification.

 Something to consider?

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


More information about the wp-trac mailing list