Created
January 21, 2017 04:49
-
-
Save ediamin/d4c97367ad3f1f602f974fe7e444c6c2 to your computer and use it in GitHub Desktop.
Hooks for saving WP ERP - CRM `photo_id` meta
This file contains hidden or 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 | |
/** | |
* $people_id = contact or company id | |
* meta data saved in 'PREFIX_erp_peoplemeta' table | |
* for hook documentation see `update_metadata` function located in `wp-includes/meta.php` WordPress core file | |
*/ | |
add_filter( 'update_erp_people_metadata', function ( $check, $people_id, $meta_key, $meta_value, $prev_value ) { | |
if ( 'photo_id' === $meta_key ) { | |
// do your things here | |
} | |
return $check; | |
}, 10, 5 ); | |
add_action( 'update_erp_people_meta', function ( $meta_id, $people_id, $meta_key, $_meta_value ) { | |
if ( 'photo_id' === $meta_key ) { | |
// do your things here | |
} | |
}, 10, 4 ); | |
add_action( 'updated_erp_people_meta', function ( $meta_id, $people_id, $meta_key, $_meta_value ) { | |
if ( 'photo_id' === $meta_key ) { | |
// do your things here | |
} | |
}, 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment