How to set variable value in one add_action and use in another add_action
-
Hello
I have following code:
add_action("save_post", function ($post_ID, $post, $update) { global $last_booking_id; if (!$update && class_exists("Flamingo_Inbound_Message") && (Flamingo_Inbound_Message::post_type === $post->post_type) ) { $last_booking_id = 'Last Booking Id '.$post_ID; // Set last submitted post in $last_booking_id } }, 10, 3); add_action('wpcf7_mail_sent', function ($cf7) { print_r($last_booking_id); // $last_booking_id returns nothing here. die('Die inside CF Mail Sent'); }, 12, 1);
I am using Contact form 7 with flamingo plugin. I am getting last submitted post id in
save_post
action.Can any body tell me how to use
$last_booking_id
value inwpcf7_mail_sent
action function.Thank you
- The topic ‘How to set variable value in one add_action and use in another add_action’ is closed to new replies.