这应该可以做到。经过本地测试,效果良好。
// Hide \'included\' and \'not included\' custom meta fields
// from the edit \'excursion\' post type page.
function my_exclude_custom_fields( $protected, $meta_key ) {
if ( \'excursion\' == get_post_type() ) {
if ( in_array( $meta_key, array( \'included\', \'not included\' ) ) ) {
return true;
}
}
return $protected;
}
add_filter( \'is_protected_meta\', \'my_exclude_custom_fields\', 10, 2 );