Forked from andrewlimaza/my-wp-zapier-send-meta.php
Created
December 13, 2019 20:26
-
-
Save mmarj/e8a06b8df973074de032854d80b07dad 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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment