Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_update_custom_post( $user_id, $user_tags ) {
- $args = array(
- 'post_type' => 'dating_profile',
- 'author' => $user_id,
- 'fields' => 'ids',
- );
- $profiles = get_posts( $args );
- if ( ! empty( $profiles ) ) {
- $profile_id = $profiles[0];
- if ( in_array( 'Type One', $user_tags ) ) {
- wp_set_post_terms( $profile_id, 'Type One Term', 'profiles_taxonomy', true );
- } elseif ( in_array( 'Type Two', $user_tags ) ) {
- wp_set_post_terms( $profile_id, 'Type Two Term', 'profiles_taxonomy', true );
- }
- }
- }
- add_action( 'wpf_tags_modified', 'my_update_custom_post', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement