Assign Current User to the created term
-
Hello,
I’m trying to create a form that when it creates a term it also assigns the current user to that term.
I want to do this so that only the assigned user and the admins can then edit it in future.
Right now I have the form setting up the term correctly but I can’t seem to assign the user.
Hook
add_action('acfe/form/submit/term/form=developer-submission-form-testing', 'my_form_term_save', 10, 5); function my_form_term_save($term_id, $type, $args, $form, $action){ // Retrieve the current user ID $current_user_id = get_current_user_id(); $user = get_field('field_60f4ec940975e'); // Update 'user' on the newly created term update_field($user, $current_user_id, $term_id); }
It’s quite possible that I’m simply not calling the hook properly as I am new to web dev.
Any help around how I can get this to work would be greatly appreciated.
Thank you
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Assign Current User to the created term’ is closed to new replies.