Saving a custom post type with post_parent resets to zero
|Reported by:||mikeschinkel||Owned by:|
|Component:||Posts, Post Types||Keywords:||has-patch|
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?
Change History (18)
comment:9 @solarissmoke — 5 years ago
- Keywords has-patch dev-feedback removed
- Resolution fixed deleted
- Severity changed from normal to major
- Status changed from closed to reopened
comment:14 @markjaquith — 5 years ago
- Resolution set to fixed
- Status changed from reopened to closed