Support » Fixing WordPress » remove_meta_box bug with pageparentdiv

  • 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');
    add_action('admin_menu', 'tc_remove_menus');

    The code works well and these meta boxes are removed. But what happens upon page update, is that the parent page resetting to zero and any child page that is being edited and saved, becomes a parent page.
    Somehow, I assume that the $_POST does not send the current state of the page_parent, and thus it is being updated to 0.

    What can be done in order to have the system not do that?
    Maybe a filter on save_post that will grab the current parent and will send it via POST upon update? It looks that it’s a core bug – if not sending this field – why it has to be changed/updated at all from its current value??

    Any ideas?

Viewing 1 replies (of 1 total)
  • I think it’s a core bug and created a trac ticket #15312 as well.
    I also published there a function I wrote that helps to solve this issue for now

Viewing 1 replies (of 1 total)
  • The topic ‘remove_meta_box bug with pageparentdiv’ is closed to new replies.