This should do it. Tested locally and it works.
// 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 );
Related Posts:
- Display all posts in a custom post type, grouped by a custom taxonomy
- Programmatically publish a post (custom post type) with custom fields
- Get list of registered custom post types
- Echo all meta keys of a custom-post TYPE
- Ordering Posts List By Taxonomy Terms?
- Change slug of registered custom post type in child theme
- Issues when rewrite rules collide?
- Custom post type permalink changing itself every other change
- WordPress Custom Shortcode Conflicting with Media Library
- Creating a gallery custom post type?
- Custom post type archive with pagination?
- Limit Authors to their Own Posts on front-end excluding admins
- Custom post type archive with dynamic taxonomy filtering – is it possible
- Multiple Archive Pages for Custom Post Types AND Taxonomies
- Add common Post Actions to Custom Meta Column
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Add information above a custom post type listing of all posts page
- Adding menu_order to CPT admin page
- Custom post type with specific category structure
- Making a Custom Post type only visible to non-users via a specific link
- reference the current category being used in the category.php page
- Search doesn’t find tags or categories in custom post types
- Add custom post type archives to search results?
- CPT Meta Searching
- Custom Post Type not visible on category page
- Rewrite URL for only archive page (custom post type)
- Show Post Thumbnail In Custom Post From Other CPT
- Archive template for custom post type only lists first 10
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Add category attribute to custom shortcode
- Is possible add class for last post of Custom Post Type?
- How to display all posts from standard posts to custom post types in a loop with pagination?
- Custom rewrite rule for hierarchical custom post type
- Retrieve value of a category’s custom field
- WP REST API – reading custom post type
- Custom Post Type with archive page but no detail page
- Custom Post Type with image gallery
- How to integrate video slide using custom post types?
- WordPress multiple custom post types capability conflict in a single menu
- Display featured image from one CPT within another CPT query
- Show titles, date of all posts on single category page
- Taxonomies don’t show up on in the dashboard page for a custom post type in wordpress 5.22
- Taxonomies relations
- How to restrict author to only access one custom post type ?
- Not sure if I should create multiple custom post type [closed]
- Adding custom taxonomy in same menu place with two custom post types
- Set Custom Post Type in Widget Settings for use in Widget
- Add CPT values to Database
- Template files for Custom Post Type and Taxonomy
- Ascending Order is not Working in Custom Post Type Listining
- How can i display movies in profile page, added by an user?
- How to get a custom type post data when it has a connection with another custom type post?
- WordPress menu with custom taxonomy
- attach CPT data to a taxonomy
- Full RSS feeds for Custom Post Types
- custom endpoints on Custom Post Type return 404 page not found
- ajax response not recieving
- How to build a WordPress post review system beside commenting
- Creating a non-hierarchical Taxonomy that behaves like categories
- Custom posttype content metabox
- Custom Post type content within a slider
- Categories won’t appear on custom post type
- Custom Post Type with Configurable Sidebar via ACF
- How to get xml file for a single post type?
- Add Custom Values to Permalinks Through Custom Fields and Posts
- “Custom Field” to Excerpt field” for pages? [closed]
- Get_the_term_list inexplicably adds values in foreach
- Single parent post lists child posts with pagination
- How to order custom posts by one of the custom fields value, ‘date’?
- Custom post type items open in archives?
- Custom Post Type, Custom Taxonomy Template: How to get current taxonomy name?
- Custom post category name showing empty
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- How can I write a function that would update any missing specific post metadata?
- Not saving custom taxonomy while using ajax
- Dynamic template page calling shared taxonomies CPT or Plugin post type : how to clone taxonomy for plugin + set up dynamic shortcode
- Show a custom post title in another custom post type in Meta box
- remove duplicate name submenu link from the custom post type
- how to display posts content on the custom css popup by clicking on each title on the sidebar?
- Modify Publish Metabox location on CPT
- Convert category to custom post type
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom Function to redirect singular post if specific meta field is empty
- How to mix 2 kinds of post types
- Help with Travel Guide Setup
- How to shows CPT which has specific meta key?
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Show custom post type under last posts configuration
- Custom post type taxonomy template and URL confusion
- Manually build WP_Query
- custom post type loop
- Custom Post save causes 500 error
- Optimise custom post type queries
- WordPress Custom Post Type and sort by Tags
- Archive page of filtered posts
- Custom post type child of custom post type
- delete custom post type using a submit form
- Custom post type navigation – 404 on page 2
- Problem with custom post type search
- Allow certain part of a page to be easily updated for client?