Sure, just check the post type of the post you’re on.
global $post; // make sure $post is available
if( get_post_type( $post ) == 'your_custom_post_type's_name' ) {
add_meta_box( ... );
}
UPDATE: I think the $post variable might not have been getting passed to get_post_type
.
Related Posts:
- How to Add Custom Fields to a Custom Post Type?
- Do_Shortcode not working for Embed
- Display custom post type and custom fields within a Bootstrap Carousel
- how to filter by last name for custom post
- Search that will look in custom field, post title and post content
- Custom Taxonomy Template Post List with Sort Order
- Display Custom Post Type Fields
- How to do a custom bookmarks post type?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- add_meta_box: Datepicker like the one for postdate?
- Custom field losing p tags on display
- Using posts and postmeta table to store custom Address Book Plugin data
- Bulk edit custom excerpt text in WordPress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Getting a “Changes you made will be lost” dialog prompt on a custom post type page
- Frontend posting – everything saves other than checkboxes?
- Search Custom Post Type Custom Fields
- Saving repeated option values in a custom query
- Query Custom Post Types by date (custom field) range
- handling csv data with a custom post type
- How to remove slug metabox from custom post type’s page?
- Custom fields in Permalinks?
- query posts and custom post type with meta key
- Dynamically add / duplicate custom meta in custom post types
- Problem fields custom date, time, and checkbox
- Custom Post type and Custom Field WP_Query
- Adding Show Less/More link to Custom Post Meta
- Sorting custom post type columns with external data and without meta values
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- WordPress Custom Fields Won’t Save
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Meta Query Not Returning Output Despite Having Matching Values
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Displaying custom field according to date
- filter search custom field query
- Custom fields for custom post type
- Warning: Invalid argument supplied for foreach() [closed]
- Add additional field to custom post_type
- Sorting posts by custom field value in array
- How to conditionally add Custom Post Type to Front Page
- Custome fields not displayed
- Displaying custom fields for custom post type generate with Custom Post Type UI Plugin
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Custom post type name and assigning custom taxonomy
- Custom post types, disable fields
- Best way to create a search for custom post type by custom field values
- Building a Portfolio and need some direction
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Display Posts Query with IF function
- Excerpt length: get first paragraph
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Create list from custom field comma separated values
- add_filter get array data before display in custom post_type
- Get previous and next custom post by custom field
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- Post Click Redirect to Custom URL instead of Single Post Page
- wp_insert_post deleting previous post custom meta
- Show posts from WP Custom Post Type selected from a field in a metabox
- Query custom post type and custom field by URL parameters
- meta query multiple values for the same key
- Show Post columns to specific users on condition
- Custom post types – meta_query: search lesson which starts sooner
- Create Inclusions and exclusions
- Populate custom post type/custom fields from an external database
- Custom Field to post_title
- Automatically convert standard posts with custom fields to custom post types
- Importing URLs of Audio Enclosures
- Retrieving custom post type fields without a post
- Get month and day from a Date Picker custom field
- custom fields not showing before get_header
- pre_get_posts with multiple post types AND a meta_key
- Search form to find custom meta box generated data
- Custom Info Box at end of posts?
- Display Custom Post if custom field is marked
- predefined custom field on registration page
- Show Custom Post Type taxonomy term that matches custom field
- Query Distinct Taxonomies of Custom Post Type
- Select Menu for Custom post Type does not save
- loop through custom post-type with two meta_keys
- Allow authors to create article image
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- Display ACF object field data using Elementor Custom Query
- Sortable admin columns ordering from custom fields isn’t combine com search and Dropdown filter
- WordPress custom field sorting, weird behavior: the latest post is at the end
- I want to understand plugin implementation of custom posts / taxonomies / metaboxes
- How to consume external API from WordPress post editor and display the response data in the custom field?