Support

Account

Home Forums ACF PRO Update post_meta with ACF date value Reply To: Update post_meta with ACF date value

  • You need to create an acf/save_post filter https://www.advancedcustomfields.com/resources/acf-save_post/ something like this.

    
    add_filter('acf/save_post', 'my_copy_date_filter', 20);
        // priority is 20 so that it runs after acf has saved the value
    function my_copy_date_filter($post_id) {
      $post_type = get_post_type($post_id);
      if ($post_type != 'eveniment') {
        // not our post type, bail early
        return;
      }
      $date = get_field('data_incepe', $post_id);
      update_post_meta($post_id, 'calendar_data', $date);
    }