Created
April 3, 2019 12:34
-
-
Save andrewlimaza/d9b8d01751867f3acfa7f4109f3130c8 to your computer and use it in GitHub Desktop.
Send WordPress user meta data to Zapier.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sorry, not really familiar with PHP, how would I use var_dump?
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
Also, this data gets cached for an hour.