Skip to content

Instantly share code, notes, and snippets.

@offroadkev
Last active June 14, 2016 06:51
Show Gist options
  • Save offroadkev/6ab122b832bde1c7587deee37f1a3355 to your computer and use it in GitHub Desktop.
Save offroadkev/6ab122b832bde1c7587deee37f1a3355 to your computer and use it in GitHub Desktop.
Hide Native WordPress Thumbnail Meta Box
<?php
/*
* Hide Native WP Thumbnail Meta Boxes by Page ID
* Note: I really should switch this to check page template, not page ID
*/
function hide_native_thumbnail_meta_box() {
// Store our page ID's
$excluded_page_ids_array = array(6,91,225,84);
// Get Post ID
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
// Check current page against our array
if( in_array( $post_id, $excluded_page_ids_array ) ) {
// Remove if match
remove_meta_box( 'postimagediv', 'page', 'side' );
}
}
add_action( 'admin_head', 'hide_native_thumbnail_meta_box' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment