the hooks “save_post…” are called too when a new post is created
then you can set default values with that
$customPostType = "customTypeCode";
add_action("save_post_$customPostType", function ($post_ID, $post, $update) {
if (!$update) {
// new item
// place to set default values
return;
}
// updating a existing item
// ...
}, 10, 3);
Related Posts:
- Create a shortcode to display custom post types with a specific taxonomy
- List the categories under custom taxonomy
- Custom Post Type and Taxonomy URL rewrite
- How to build a complex page structure
- Populate Taxonomy from Custom Posts
- How to replicate some of Drupal Views functionality in WordPress?
- Archive page with multiple taxonomies rewrite
- Show related posts on single page by custom taxonomy on custom post
- Exclude from search all custom posts which are NOT in a taxonomy term
- Sorting for each custom taxonomy
- How to get_queried_object on multiple objects?
- Dynamic variable for custom taxonomy in loop?
- wp_insert_post custom taxonomy
- custom taxonomy – Template not working
- Count number of posts which exist in 2 taxonomies?
- Getting taxonomy terms used by custom post type
- Append taxonomy terms as class names in markup?
- Want to turn WordPress into a paid subscription directory
- Removing Duplicate Custom Taxonomy Terms from within a Dropdown Select?
- Why is my custom loop not filtering correctly nor paginating?
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Custom post types with custom directories
- How to customize admin posts based on the user who is logged in
- How to output wordpress custom tags separated by comma?
- Custom taxonomy template for multiple custom post types
- Add/Remove current_page_parent class
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Custom Taxonomy Permalinks Redirection
- Use different taxonomies in different custom post types’ permalinks?
- shortcode to show custom post types by category
- Single Template that can be applied only via URL
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Search Custom Post Type & Taxonomies
- How to hook custom taxonomies to custom post types and make the permalinks work?
- Help need making decision. Ads rotating site on wordpress
- Categories of custom taxonomy don’t show any posts
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Use Custom Post Type archive page for the taxonomies term archive page
- Is it possible to have dedicated page for parent/child taxonomy?
- Can a Custom Taxonomy be named “category” like normal Posts?
- How to use terms from the same custom taxonomy in different roles in a custom post type?
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- Display a grid of taxonomy terms at root taxonomy page
- Nested Custom Post Type or Custom Post Type Parents?
- limit value taxonomy based on previous taxonomy value wordpress
- Display Custom Taxonomy Alphabetically
- posttype/taxonomy/term archive page 404 error
- How to add attributes to taxonomies that may be different from post to post?
- Custom post type, permalinks, taxonomies and blog posts
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Taxonomy in URL
- Display related custom taxonomy posts in sidebar
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- Different slug taxonomy for two different CPT
- custom post type and custom taxonomy
- Why does my taxonomy have a category style div id?
- Get custom post type categories to show up in menus
- Get taxonomy term by slug in post on archive page
- Query not work for current taxonomy
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Hide custom post type from search based on custom taxonomy
- Custom Post type date archive for custom taxonomy
- How to loop through custom taxonomies and sub taxonomies and display posts?
- Replicating category/location page heirarchy
- WordPress custom permalink and archive link for custom post type
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Non-permalink custom taxonomy not found
- Building a Portfolio and need some direction
- Looking up custom taxonomy IDs by name
- loop over all custom taxonomies for current custom post type and their values
- Correct way of adding taxonomy to a custom post type
- Query Custom Post Type by Taxonomy
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- How do I disable the built-in editor and automatically configure the properties of new pages?
- Change dynamically the dropdown list value
- CPT UI: Connect a custom post type to a custom post type
- List posts of custom post type under category name
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- Custom taxonomy- only output relevant terms
- Post types showing tables…Can I do that?
- Post Custom & Taxonomy 404 error
- Custom Post Type tag taxonomy “Page Not Found”
- Remove custom post type slug but keep related category taxonomy permalink
- page not found for example.com/custom-post-name
- Dropdown switching subcategories portfolio
- Is it possible to add and display custom post types to an array?
- Custom post type and custom taxonomies display
- How to solve performance issue caused by custom post type overview with 20k+ custom taxonomy terms
- Prevent repetitive terms in get_the_term_list
- Displaying posts exclusively in their category (not parent)
- Show taxonomies from specific CPT
- Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy
- Category / Custom Post Type permalink issue
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- Inserting two categories
- How to manage a bookstore
- Permalinks for Custom Post Types and Taxonomies