Created
June 30, 2020 10:30
-
-
Save New0/2cdf112073036ee988cb3d4d5d4f38b9 to your computer and use it in GitHub Desktop.
Caldera Forms using Custom fields add-on, save the new Post ID as User meta data.
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 | |
/** Hook in when custom fields are saved by CF Custom fields to write entry ID as user meta */ | |
add_action( 'cf_custom_fields_post_save_meta_key_to_post_type', function($value, $slug, $post_id, $field, $form){ | |
if( $slug === "meta_post_id" ){ | |
if( $value === $post_id){ | |
return; | |
} else { | |
update_user_meta( get_current_user_id(), "meta_post_id", $post_id ); | |
} | |
} | |
}, 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment