Storing data from add_action and retreiving from different add_action
-
I have two different actions being triggered. I need to store some results from the first action before the second action is triggered because I’m comparing the two.
Not sure how I should go about doing this? I’ve read it’s a bad idea to use $_GLOBAL or $_SESSION.
Any help is appreciated.
Thanks!
add_action ('trigger_1','function_1'); function function_1($user_id){ $var1 = get_user_meta( $user_id, 'custom_meta', 'true' ); } /// User meta is changed before second action triggers /// add_action ('trigger_2','function_2'); function function_2($user_id){ $var1 = get_user_meta( $user_id, 'custom_meta', 'true' ); if ($var1 != $var2) { wp_mail( '[email protected]', 'subject', 'meta changed' ); } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Storing data from add_action and retreiving from different add_action’ is closed to new replies.