Support

Account

Home Forums General Issues unset a field Reply To: unset a field

  • http://www.advancedcustomfields.com/resources/acfsave_post/

    
    add_action('acf/save_post', 'my_acf_save_post', 20);
    function my_acf_save_post($post_id) {
      $value get_post_meta($post_id, 'first_field_name', true);
      if ($value) {
        // delete the second value
        delete_post_meta($post_id, 'second_field_name');
        // delete the acf field key
        delete_post_meta($post_id, '_second_field_name');
      }
    }