/** * Automatically add our taxonomy term upon publish. * * Term needs to already be created in the database. * * @since 1.0.0 * * @param int $post_id Published post ID. */ function pluginize_auto_add_taxonomy_terms_on_publish( $post_id = 0 ) { if ( ! wp_is_post_revision( $post_id ) ) { $terms = array( 25 ); // Set to the appropriate term ID. wp_set_object_terms( $post_id, $terms, 'category' ); // You will need to customize the taxonomy. } }