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?
- Wrap meta boxes & data handling for specific post types in classes?
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Adding CSS to custom post type admin page causes error
- Problems wp_insert_post and save_posts filter
- Redirect to another page using contact form 7? [closed]
- Custom Post Archive is not working
- Suggestion on custom post type/ taxonomy relationship
- How to add multiple images to a custom post type without plugin [closed]
- Add action to fire when a published post is updated
- Using preg_replace to filter custom textarea
- How to pass variables to a function argument using add_action [duplicate]
- To use custom post types, or not to use
- Autocomplete or suggest from post titles inside plugin
- Show all tags on custom post type
- Create new custom post and post category of same name
- wordpress remove views from action links in a custom post
- When should I create custom post types?
- publish_post action doesn’t work
- Custom post type’s extra fields – how to handle?
- Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
- Save Multiple Metabox values
- Using ACF default value to autoincrement a number field
- Send a conditional email notification when a custom field value changes in Post Type
- WordPress custom post type capabilities issue
- HowTo: Custom Post Type (Meta) to Custom Table
- how to set a WP Plugin’s url
- Getting 400 Bad Request on AJAX Call
- How to hook WP initialization without modifying functions.php
- Main query not querying any posts in custom taxonomy template
- Custom Empty Results page for my Custom Post Type
- Submit Form data to another page via Ajax (WordPress Way)
- How to create multiple editor?
- Custom post type, have only my meta boxes
- detect your custom post type in WordPress
- Add categories to a page with out using Custom Post Types
- Does using `add_action( ‘init’…` cause performance issues?
- Use remove_meta_box conditionally on custom post type
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- Theme independent plugin by using default page template
- Option page’s form doesn’t work
- Create metaboxes based on custom post type
- How to add and clear custom post types and taxonomies in a plugin? Considerations for existing data
- How can I have different content for different countries?
- How to group navigation items in the admin panel
- Include php on a specific page template
- wp_trash_post action hook with custom post type
- What’s an efficient way to change the post status of many posts at once?
- How do I amend form data before it is saved for a custom post type
- What do the numbers mean at the end of add_action(‘save_post’)…?
- Pods CMS: How to add custom column to Adnvanced Content Type
- Running a wordpress action when a custom post type term (taxonomy category) is changed
- How can I include active content in a custom post type?
- Hook for page Request?
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- Dynamically insert code to custom post type loop
- Show current custom taxonomy
- How to insert data into meta box from another plugin?
- How exclude or skip post type with get_next_post_link
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- How to access the thank you page from the single post?
- How do I add custom HTML to the content of an archive page’s posts?
- How do you make a list and list item relation if custom post types?