Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- value_1 = red blue; value_2 = gold silver;
- merged_values = red blue gold silver;
- // This function runs after your post is saved
- function my_acf_save_post( $post_id ) {
- // Get new value of field 1 and remove ;
- $value1 = str_replace( ';', '', get_field( 'field1', $post_id ) );
- // Get new value of field 2 and remove ;
- $value2 = str_replace( ';', '', get_field( 'field2', $post_id ) );
- // Merged values with ; on the end
- $merge = $value1.' '.$value2.';';
- // Update field 3 with the new value which should be
- // value1 value2;
- update_field( 'field3', $merge, $post_id );
- }
- add_action('acf/save_post', 'my_acf_save_post', 20);
Add Comment
Please, Sign In to add comment