Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Created February 17, 2015 03:17
Show Gist options
  • Select an option

  • Save designbuildtest/d3b4723f6f98179e7018 to your computer and use it in GitHub Desktop.

Select an option

Save designbuildtest/d3b4723f6f98179e7018 to your computer and use it in GitHub Desktop.
Remove ATTRIBUTES and EXCERPT meta boxes when viewing the Homepage.
function myplugin_remove_homepage_metaboxes() {
if ( isset( $_GET['post'] ) ) {
$post_id = $_GET['post'];
} elseif ( isset( $_POST['post_ID'] ) ) {
$post_id = $_POST['post_ID'];
}
$front_page = get_option( 'page_on_front' );
if ( ! isset( $post_id ) ) {
return;
}
elseif ( $post_id == $front_page ) {
remove_meta_box( 'pageparentdiv', 'page', 'side' );
remove_meta_box( 'postexcerpt', 'page', 'normal' );
}
}
add_action( 'add_meta_boxes', 'myplugin_remove_homepage_metaboxes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment