Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // hide support for certain admin "features" (metaboxes) for some pages
- function hide_features() {
- if ( isset($_GET['action']) && $_GET['action'] === 'edit' ) {
- $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
- if( !isset( $post_id ) ) return;
- $templated_pages_names = array(
- // 'template-contact.php',
- );
- $templated_pages_ids = array();
- foreach ($templated_pages_names as $page_name) {
- $templated_page_id = get_page_by_custom_template($page_name, 'id');
- if ($templated_page_id) {
- $templated_pages_ids[] = $templated_page_id;
- }
- }
- $optioned_pages_ids = array(
- get_option('page_for_posts'),
- get_option('page_on_front')
- );
- $pages_no_content_editor = array_merge($optioned_pages_ids, $templated_pages_ids);
- $features_to_remove = array('editor');
- // for some reason we're unable to remove thumbnail and page-attributes support with this...
- if(in_array($post_id, $pages_no_content_editor)){
- foreach ($features_to_remove as $feature) {
- remove_post_type_support('page', $feature);
- }
- }
- }
- }
- add_action( 'do_meta_boxes', 'hide_features' );
Add Comment
Please, Sign In to add comment