Last active
June 14, 2016 06:51
-
-
Save offroadkev/6ab122b832bde1c7587deee37f1a3355 to your computer and use it in GitHub Desktop.
Hide Native WordPress Thumbnail Meta Box
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 | |
/* | |
* 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