Created
April 27, 2016 03:05
-
-
Save stephanieleary/2913931cd7e39040a7ced928fad50ba2 to your computer and use it in GitHub Desktop.
Close some meta boxes by default instead of hiding them altogether
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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