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 Answer 1

2

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.

2
  • 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
    Commented Jun 3, 2017 at 21:04
  • I'm glad to be able to help. Commented Jun 3, 2017 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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