Update post meta value as date difference between two fields
Since you already mentioned that you are using these codes, I assume they both work for you. Now, I have combined them for you into a single function that updates the metadata after a post is published: function set_date_difference($post_id){ // Get the value of the first field $date1 = get_field(‘date_start’, $post_id, false ); $date1 = … Read more