Setting Default Category for Custom Post Type Upon Autosave
Use the save_post action hook and in the call back function use wp_set_object_terms( $object_id, $terms, $taxonomy, $append ) function. For your custom post type the code can be like this function save_book_meta( $post_id, $post, $update ) { $slug = ‘book’; //Slug of CPT // If this isn’t a ‘book’ post, don’t update it. if ( … Read more