| <?php |
| |
| add_action('init', 'hwk_deregister_builtin_post_type'); |
| function hwk_deregister_builtin_post_type(){ |
| global $wp_post_types; |
| |
| $unregister = array( |
| 'post', |
| 'page', |
| ); |
| |
| foreach($unregister as $post_type){ |
| if(!post_type_exists($post_type)) |
| continue; |
| |
| $post_type_object = get_post_type_object($post_type); |
| |
| $post_type_object->remove_supports(); |
| $post_type_object->remove_rewrite_rules(); |
| $post_type_object->unregister_meta_boxes(); |
| $post_type_object->remove_hooks(); |
| $post_type_object->unregister_taxonomies(); |
| unset($wp_post_types[$post_type]); |
| |
| do_action('unregistered_post_type', $post_type); |
| |
| $wp_post_types[$post_type] = new stdClass(); |
| $wp_post_types[$post_type]->show_in_menu = false; |
| $wp_post_types[$post_type]->publicly_queryable = false; |
| $wp_post_types[$post_type]->_builtin = false; |
| $wp_post_types[$post_type]->name = false; |
| |
| } |
| } |