Try this way:
add_action( 'save_post', 'myFunc');
function myFunc(){
if ($post->post_type == 'cpt' ) {
// do action here
}
OR
add_action( 'save_post', 'myFunc');
function myFunc(){
if ( 'cpt' == get_post_type() ) {
// do action here
}
Related Posts:
- How to register custom post types in a plugin?
- How to Add Custom Taxonomy To Woocommerce Plugin
- Prevent trash/delete action on specific post types
- How to add custom content template part for a custom post type on main query using a plugin
- Why The Init Hook For Custom Post Types
- register_taxonomy with multiple object type and update_count_callback
- How often do you need to register_post_type?
- How to use a dedicated template for the Custom Post Type from a plugin?
- WordPress custom post action hook
- Remove POST_TYPE from custom post type permalink
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- How to append element after thumbnail
- How to have the right design for a custom post type without accessing themes
- Custom Post Type | Fatal Error on register_post_type()
- Set object terms not working on plugin activation
- custom post type not showing in menu
- Custom posts don’t work
- Adding a custom post type taxonomy template in plugin
- Addition of custom option panel crashes Media Library & Admin Area
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- Custom fields for custom post type
- ACF in wordpress
- post_parent in custom post type
- Unable to format dates to put in event calendar
- Custom post type in Custom widget – $listItem
- Validate Custom Post Type fields
- how can i show a google map in custom post type
- Restrict Custom Post Type to One Item
- Custom Post Type Front Page Gives 404
- Show Post columns to specific users on condition
- Insert custom taxonomy into category query
- Run query on specific admin options page and send results to select field in another function
- Custom post type that lets users create a set of posts?
- Can’t save custom post type fields
- get_post_types doesn’t work in plugin
- Add Excerpt On Quicksand Plugin
- Custom Post Types in plugins?
- How to intercept publish post for a custom post type “event”
- Is flush_rewrite_rules necessary when creating a custom post type? Why?
- Unable to filter on field on edit.php page
- What hook should be used to programmatically create a post only when master post is updated?
- Using posts and postmeta table to store custom Address Book Plugin data
- template_redirect not working, apparently for no reason
- How to add inline css/js inside a shortcode
- handling csv data with a custom post type
- What are the benefit in adding hook in the init() hook?
- GravityForm: Populate Dropdown with custom post type [closed]
- “add_post_type_support” with Custom Post Type & ACF
- Custom Post Type rewrite
- Admin notice not displaying
- WooCommerce product search titles only
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Insert Multiple Post with Same Publish Button
- Plugin: register custom post types, child ready and performance best practices
- How can I make a custom post type sticky?
- How to get all of the activate_plugin action parameters?
- Getting meta in editor plugin, and event triggering issue
- Broken featured images are uploading from frontend
- limit value taxonomy based on previous taxonomy value wordpress
- How to change wp prefix for custom post type only?
- Metabox not show in categories custom post type cmb2
- How to use TinyMCE Editor for one of my custom post meta field?
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Custom Post Archive is not working
- Save Multiple Metabox values
- Submit Form data to another page via Ajax (WordPress Way)
- Create metaboxes based on custom post type
- What’s an efficient way to change the post status of many posts at once?
- How exclude or skip post type with get_next_post_link
- CMB2 metabox create select with list of post from CPT
- Custom post types, disable fields
- Limiting Amount of Posts in a Custom Post Type again
- Custom Post Type, Custom Columns List
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- Why are custom taxonomies only appearing on the edit page of one of these types, but not the other?
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Problem with checked box on wp car manager plugin
- URL issue retrieving Custom Post Types using Backbone JS API
- WordPress Custom Post Loop
- ‘Simple’ Reservation System
- Post Click Redirect to Custom URL instead of Single Post Page
- Accessing download link from the loop with WP Download Manager Pro
- Reading Custom Post data so I can have user update Manually
- Remove action added in plugin class from theme
- Custom Post type plugin is using theme single.php and style.css
- call a function when insert and update a custom post type
- Create Inclusions and exclusions
- Adding CPT changes entire layout of my site except for the archive of that CPT
- do action inside a class is not working
- Registering an optional custom post type from a plugin
- Custom Info Box at end of posts?
- Generate custom RSS from a plugin
- How to add jquery to my custom post type wp plugin
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- How to add post type in masonry posts elementory widget
- Remove plugin’s custom post type archive page and single pages [closed]
- How to delete unnecessary custom post types in the UI
- add_filter > posts_where works partially
- How to make content as required in custom post type?
- How to consume external API from WordPress post editor and display the response data in the custom field?