you can first remove the category meta box from Actors post type edit screen like this
function remove_custom_taxonomy()
{
remove_meta_box( 'categorydiv', 'custom_post_slug', 'side' );
}
add_action( 'admin_menu', 'remove_custom_taxonomy' );
then create a function that will add the category on save_post
function default_category($post_id){
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
// check for post type
if ('Actors' == $_POST['post_type']) {
$Default_category_id = '23';
wp_set_post_terms( $post_id,$Default_category_id , 'category', ture );
}
}
hope this helps
Related Posts:
- Adding categories to custom post type in permalink
- How to change permalink structure for custom post type and it’s taxonomies?
- Filtering a custom post type by custom taxonomy in archive template
- Setting Default Category for Custom Post Type Upon Autosave
- How to build a complex page structure
- Only list categories that contain posts of a specific custom post type
- Load custom posts with same tag as page
- Hide/Show only specific categories in wp-admin new-post.php
- Get categories for a specific post – Custom post type
- Include custom post types in categories widget
- How to get dynamically custom post type that are under a certain category
- Template tags to display custom post type posts in category template?
- How can I add single catogory for custom post type?
- WP Query group/order by category name
- Get the post_type of current taxonomy or category page
- How to show custom taxonomy in the permalink?
- Categories and Tags not working!
- Loop through categories and create tab for each
- Query custom post types
- get_categories() for only CPT
- category.php displays ALL posts instead of just those with the current category
- custom taxonomy archive by year
- Display Next/Prev when looping Custom post-types archive?
- Custom Post Types and Categories?
- Set a default category – if the user didn’t select one- before creating a post
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Possible for Category Base and Custom post Type to share the same slug/permalink?
- Weird problem happening with custom taxonmy when creating/updating posts
- Custom Post Types and independent Categories – complex Taxonomy
- Should I use custom taxonomy or custom post type
- CPT Archive with core Category
- Custom Post Type Archive Page Filtering
- get_posts() with custom post type does not work outside page.php
- Get parent categories of custom post type
- How to query_post custom posts within default taxonomy?
- Custom Post Type With Categories
- Display posts from Custom Post Type in category page on front-end
- Showing posts from different categories and from custom post type
- Multiple level category drop-down from the WordPress dashboard
- Getting categories of posts under a custom taxonomy
- How to get categories linked in posts for a specific post type
- How to edit this code to get the categories in achieve page?
- Category with post type pagination returns 404
- Get the category from custom post type
- How to create a gallery page with categories?
- Custom Post Slug same as Parents Category Slug
- Cross reference custom post types
- Make a custom_post translatable
- browse by category and tags?
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Custom templates for a specific category
- Create new custom post and post category of same name
- multiple custom post type on category page
- Custom Post Type Category URL
- Want a custom query with just one category but from all custom post types
- Custom Post Type Categories URL not displaying posts
- WP Query results showing posts outside of category ID
- How to get the current category with custom posts
- Better approach for a WordPress Inventory
- Showing all posts and custom post types by using one category
- List child categories from parent category on custom taxonomy page
- How to properly use Categories with Custom Post Types
- Custom post not appearing under custom taxonomy category
- Custom post type category permalinks and archive pages
- If custom category search then page 2 not found
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Show the categories the current post has
- Display custom post types by category
- Searching in multiple category + URL hierarchy in real estate WordPress site
- How to display custom taxonomy term specific post?
- Category permalinks don’t work even after flushing
- How to sort post category using its Description
- Custom WordPress theme not displaying posts from category
- Wanting to list all Post types under a common category
- How to show posts of the same category on a page?
- Get posts in custom post type categories
- Do not load the categories in Category.php
- Counting the number of post without custom post type
- Modify the category post counting function
- Reuse the “category” slug for a custom post type
- Custom Template for CPT Categories
- Custom post types not displaying per category
- How To Display Category list from Portfolio post type plugin?
- Do not output category and tag URLs
- Dropdown switching subcategories portfolio
- Display custom Taxonomies same as listing Categories
- Custom Post type archives / categories give 404
- Custom Post Type – Admin Columns
- Problem to show custom post type in archive page category wise
- Need to build custom metabox select prev posts by category
- Category / Custom Post Type permalink issue
- Categories in custom post types
- Sorting custom post types by category?
- categories of custom post type shows in CMS but not in the frontend webpage
- Categories and page filtering with pre_get_posts
- Category names on CPT archive pages [closed]
- Get all custom_post_type posts + blog posts from one category in a single query
- Select Category as Page Parent
- Is it possible for post and custom post type to share a category base slug?