Skip to content

Instantly share code, notes, and snippets.

@stephanieleary
Created April 27, 2016 03:05
Show Gist options
  • Save stephanieleary/2913931cd7e39040a7ced928fad50ba2 to your computer and use it in GitHub Desktop.
Save stephanieleary/2913931cd7e39040a7ced928fad50ba2 to your computer and use it in GitHub Desktop.
Close some meta boxes by default instead of hiding them altogether
<?php
add_action( 'admin_init', 'my_close_meta_boxes', 99 );
function my_close_meta_boxes() {
$post_types = get_post_types( array( 'public' => true ) );
foreach ( $post_types as $type ) {
// Close Excerpt on all post types
add_filter( "postbox_classes_{$type}_postexcerpt", 'my_custom_closed_meta_boxes' );
}
}
function my_custom_closed_meta_boxes( $classes ) {
array_push( $classes, 'closed' );
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment