mehrshaddarzi
10/14/2018 - 8:33 AM

Default Hide MetaBox in wordpress

Default Hide MetaBox in wordpress

//https://wordpress.stackexchange.com/questions/15376/how-to-set-default-screen-options

add_filter( 'hidden_meta_boxes', 'custom_hidden_meta_boxes' );
function custom_hidden_meta_boxes( $hidden ) {
    // Hide meta boxes on the single Post screen
    // Left column  
   $hidden[] = 'postexcerpt';       // Post Excerpts
   $hidden[] = 'trackbacksdiv';     // Send Trackbacks
   $hidden[] = 'postcustom';        // Custom Fields
   $hidden[] = 'commentstatusdiv';  // Discussion
   $hidden[] = 'commentsdiv';       // Comments - Add comment
   $hidden[] = 'slugdiv';           // Slug
   $hidden[] = 'authordiv';		    // Author
   
   // Right column
   $hidden[] = 'submitdiv';		    // Publish
   $hidden[] = 'formatdiv';		    // Format (for themes that use Post Format)
   $hidden[] = 'categorydiv';	    // Categories
   $hidden[] = 'tagsdiv-post_tag';	// Tags
   $hidden[] = 'postimagediv';	    // Featured Image 
    
    // Hide meta boxes on the single Page screen
    // Left Column
    $hidden[] = 'revisionsdiv';   	// Revisions
    $hidden[] = 'postcustom'; 		// Custom Fields
    $hidden[] = 'commentstatusdiv'; // Discussion		
    $hidden[] = 'commentsdiv'; 		// Comments - Add comment
    $hidden[] = 'slugdiv';          // Slug
    $hidden[] = 'authordiv';		// Author
    
    // Right column
    $hidden[] = 'submitdiv';		// Publish
    $hidden[] = 'pageparentdiv'; 	// Page Attributes
    $hidden[] = 'postimagediv'; 	// Featured Image 
    
        return $hidden;
}