Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created April 3, 2019 12:34
Show Gist options
  • Save andrewlimaza/d9b8d01751867f3acfa7f4109f3130c8 to your computer and use it in GitHub Desktop.
Save andrewlimaza/d9b8d01751867f3acfa7f4109f3130c8 to your computer and use it in GitHub Desktop.
Send WordPress user meta data to Zapier.
<?php
/**
* This requires version 1.3+ for WP Zapier Plugin - https://yoohooplugins.com/plugins/zapier-integration/
* You may follow this function as a guide to send user meta to Zapier, or any other data really.
* This code runs whenever a user's profile is updated.
* Add the below code to a custom plugin/Child Theme function.php
*/
function my_wp_zapier_send_meta( $array, $user, $user_id ) {
// Get the user meta - value will be "Cherie"
$spouse_name = get_user_meta( $user_id, 'spouse_name', true );
// $meta_key = get_user_meta( $user_id, 'meta_key', true );
// Add data to the array we are sending to Zapier or another service/webhook.
$array['spouse_name'] = $spouse_name;
return $array;
}
add_filter( 'wpzp_send_data_profile_update_array', 'my_wp_zapier_send_meta', 10, 3 );
@andrewlimaza
Copy link
Author

Please open a support ticket on https://yoohooplugins.com/support and we'll try help you if we can or advise you further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment