Any function hooked to the save_post
hook will run whenever you save a post. That is expected behaviour.
You should use the hook save_post_{$post->post_type}
to specify to which post type that callback is asociated. That way, it will only be called when saving a post of type {$post->post_type}
See the hook documentation
Related Posts:
- update_post_meta() whenever custom post type is updated
- Trigger “unsaved changes” dialog for custom post meta changes
- Custom post type meta fields missing on save_post_type
- How to save post_status using action save_post?
- Custom meta box data not saving
- Problem with ‘save_post’ hook not running
- what is the correct way to compare dates in a WP query_posts meta_query
- Get post with multiple meta keys and value
- Echo all meta keys of a custom-post TYPE
- Why won’t my metabox data save?
- Post metadata deletes itself
- Is there an easy way to AJAX-ify saving of post?
- Custom Post Type: Set post_title equal to a custom post type field
- I can’t set meta_key in my custom post type query
- How can I include meta box content when searching?
- update a post meta from a single table cell TablePress
- Automatically adding meta data to posts or multiple query help
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- How do I sort a custom post type admin column using two meta keys?
- How can I display my custom metaboxes on a custom post template?
- Custom Post Type, Saving Multiple Checkboxes
- Create a random unique 6 digit number as custom field for custom post type
- Export entries and multiple custom field meta to .csv?
- how to interconnect custom post types?
- orderby in custom WP Query does not work
- Insert post metadata for all posts in CPT at once if metadata no existent
- Display custom post type from dynamic custom field
- Notice: Undefined index: error and understanding wordpress
- Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?
- Deleting Custom Posts & Meta Data on Uninstall
- How can I set taxonomy programmatically
- How do I create an archive page as a including metadata?
- Two Custom Post Types Many to Many Relationship
- how can I register a post_meta field in an existing CPT and then call it again with get_post_custom()?
- post meta parameter in post custom-post-type endpoint with restapi
- Update postmeta Parent when post_status child change
- Update database from Quick Edit according to Checkbox state of Custom Post Type
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Dynamic Custom Fields
- Show Custom Post Type meta boxes only on Page Edit
- Custom filter function not working with Custom post type
- Importing Data from a Non-WordPress database, into WP
- List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
- Meta Data for Custom Post Type not saving
- Check if post with same meta value exists
- Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?
- Mutiple Select only POSTing 1 value
- Archieve.php not loading for custom post type
- Custom Post Type Metadata Not Saving
- Create Array from custom post type to display a slider
- What do the numbers mean at the end of add_action(‘save_post’)…?
- Values from meta-box not on $_POST
- Returning a custom content types with meta values
- Custom post type suddenly stoped working after WordPress 5 update
- How to show custom field on specific custom post type posts only when filled
- is_main_query() never called on WP 4.4
- How can I output WPAlchemy repeating fields meta values in my page template?
- Meta box data not saving
- Meta box with front-end styling
- How can I get some of a posts meta data whilst it is still inserting?
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Cannot Save MetaBox Data in Custom Post Type
- best way to use custom taxonomy, post type and meta in a job system
- Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
- How to order custom posts by one of the custom fields value, ‘date’?
- WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- How to create review point system for CPTs (many-to-many relationship)
- After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
- How can I write a function that would update any missing specific post metadata?
- SELECT custom post type and its meta in SQL
- How to keep custom post type related information
- Custom attachment function not working in v5.4.2?
- Can’t save meta box data in WordPress using custom post types
- How to check for duplicate record before saving a Custom Post Type
- How can I use a custom template to load custom post type posts based on a post_meta value
- Save_post acf data not updating category of post type
- How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
- Custom Function to redirect singular post if specific meta field is empty
- Saving Child Terms on front end not setting parent
- Link two different post using there post_id in post meta
- Custom post type: “transition_post_status” action get title and other fields
- update a posts of other custom post type
- How do I extract the contents of a CPT’s custom field for all posts?
- Delete custom post type metadata without deleting the post in admin area
- Order by post meta value gets random results
- Metabox is not saving
- How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
- meta query always fails even if data is correct
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Rich Custom Field for Custom Post type not saving
- Custom post type submenu sorted by specific meta_key & meta_value
- Post AND page parameter for WP function
- How to display Author Profile based on Custom field value
- Automatically add custom taxonomy when meta value gets to a set number or beyond
- Check for custom field value in different post type than current one and do something
- Changing to different post type maintains the redirection?
- How do I add the “orange counter” next to a Custom Post Type?