Updating a post's custom taxonomy using Wordpress theme functions

Viewed 49

I've got a script that takes a field from a Gravity Forms in WordPress and updates the custom field within a post. We've not encountered an issue that means instead of updating a custom field we've got to add a tag within a custom taxonomy. I've created a taxonomy called meeting-users which needs to add the ID number from the form.

add_action( 'gform_after_submission_25', 'set_post_content', 10, 2 );
function set_post_content( $entry, $form ) {
    $value = rgar( $entry, '64' ); // gets the user ID
    $postId = rgar( $entry, '41' ); // gets the current post id
    update_post_meta( $postId, 'wpcf-registered-users', $value ); // This needs to update the new custom taxonomy called meeting-users
}

Anyone know how to update the custom taxonomy so when the form submits it would add the userID?

0 Answers
Related