1

Hi i am not very experienced with plugin development and i am using edit_{$taxonomy} | Hook but i am not able to get new updated values using this hook. Here is my code

function action_edit_taxonomy( $term_id, $t_id ){
$term = get_term($term_id);
print_r($term);
exit;
};
add_action( "edit_um_user_tag", 'action_edit_taxonomy', 10, 6 );

But $term is returning old term saved value, not which i am going to update now. So how i will be able to get new value which i am going to update now. I will really appreciate it if someone will guide me that where i am wrong with this code. I have tried to find out help but still the problem is there. I am already using get_term() function for create_{$taxonomy} | Hook and get_term is working for it but it is not returning correct value for edit_{$taxonomy} | Hook.
Thank you!!

1

You are getting old version of the term, because edit_{$taxonomy} action is fired after the term is updated but before term's cache is cleared. Use edited_{$taxonomy} hook, which fires your action after the term is updated and its cache is cleared.

  • Thank you so much for your help and time. It is working perfectly for me now and it saves lot of my time. I really appreciate your help. – wplearner Jun 3 '17 at 21:04
  • I'm glad to be able to help. – Frank P. Walentynowicz Jun 3 '17 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.