[wp-trac] [WordPress Trac] #15312: Bug with remove_meta_box bug with pageparentdiv when saving a page

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 3 23:01:08 UTC 2010


#15312: Bug with remove_meta_box bug with pageparentdiv when saving a page
----------------------------+-----------------------------------------------
 Reporter:  maorb           |       Owner:                 
     Type:  defect (bug)    |      Status:  new            
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.0.1          
 Severity:  normal          |    Keywords:  pages, meta_box
----------------------------+-----------------------------------------------
 Hi,

 I use some code to remove the meta_box of some boxes in the page edit. I
 also remove the parent_page select box to users that not have admin
 capabilities, in order that thet parent page won't be modified.

 My code is something like -

 {{{
 function tc_remove_menus () {
 global $current_user;
 if (!current_user_can('administrator')) :
 $boxes = array(  'passworddiv', 'tagsdiv', 'trackbacksdiv',
 pageparentdiv', commentstatusdiv', 'commentsdiv', 'authordiv',
 'revisionsdiv', 'postcustom' );
         foreach ($boxes as $box){
                 remove_meta_box($box, 'page', 'normal');
         }
 endif;
 }
 add_action('admin_menu', 'tc_remove_menus');
 }}}

 The code works well and these meta boxes are removed. But, what happens
 upon a page update, is that the parent_page value is being reset to zero
 and thus any child page that is being edited and saved, becomes a parent
 page and loses its place as child page.

 Somehow, I assume that after removing the meta box, the $_POST does
 contain the current state of the page_parent, and thus it is being updated
 to 0.

 It looks that it's a core bug - since if not sending the page_parent field
 when saving the post/page - why is this field has to be changed/updated at
 all from its current value??

 Thanks

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


More information about the wp-trac mailing list