[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:41:24 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:  Post Types    |     Version:  3.0       
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
Changes (by mikeschinkel):

  * component:  General => Post Types


Comment:

 FYI, I was about to get around the problem by adding in a view-only
 metabox that had a hidden "parent_id" input element:


 {{{
 add_action('add_meta_boxes_location','my_add_meta_boxes_location');
 function my_add_meta_boxes_location($location) {
         if ($location->post_parent) {
 add_meta_box('location_parent','store','my_location_parent_meta_box','location','side');
         }
 }

 function my_location_parent_meta_box($location,$metabox) {
         $store = get_post($location->post_parent);
         $html = <<<HTML
 <div id="div" class="postbox">
         <h4>{$store->post_title}</h4>
         <input type="hidden" id="parent_id" name="parent_id"
 value="{$store->ID}" />
 </div>
 HTML;
         echo $html;
 }

 }}}

 It would still be nice it editing did not overwrite values, but unless and
 until that if fixed this metabox can be used.

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


More information about the wp-trac mailing list