WordPress.org

Forums

Removing META Boxes from Post Page (2 posts)

  1. futurepocket
    Member
    Posted 4 years ago #

    Hi,
    I want to remove some of the META boxes in the post page so my authors/contributors including myself don't have access to them. I've removed the ones that come originally with WordPress, but for some reason, the META boxes inserted by plugins won't go away:

    function remove_post_custom_fields() {
     remove_meta_box( 'commentstatusdiv' , 'post' , 'normal' ); //removes comments status
     remove_meta_box( 'commentsdiv' , 'post' , 'normal' ); //removes comments
     remove_meta_box( 'authordiv' , 'post' , 'normal' ); //removes author
     remove_meta_box( 'st-clicks-tags', 'post', 'normal');
     remove_meta_box( 'socialize-buttons-meta', 'post', 'normal');
     remove_meta_box( 'sharebar-settings', 'post', 'normal');
     remove_meta_box( 'simpletags-settings', 'post', 'normal');
     remove_meta_box( 'postexcerpt', 'post', 'normal');
     remove_meta_box( 'slugdiv', 'post', 'normal');
     remove_meta_box( 'authordiv', 'post', 'normal');
    }
    add_action( 'admin_menu' , 'remove_post_custom_fields' );

    That's what I've added in there, I know all the 'id's' are right, but for some reason, the st-clicks-tags down to simpletags-settings won't disappear from the post page. Any ideas?

  2. bigdrobek
    Member
    Posted 3 years ago #

    Try to play with the parametr "Normal" change with "side".

    I use this for remove boxes from dashoard...

    // odebrání widgetů z nástěnky
    function remove_dashboard_widgets(){
      global$wp_meta_boxes;
      unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
      unset($wp_meta_boxes['dashboard']['normal']['core']['blc_dashboard_widget']);
      unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
      unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
      unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
      unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
      unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
      unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
      unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
    }
    
    add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20);

Topic Closed

This topic has been closed to new replies.

About this Topic