Support

Account

Home Forums Backend Issues (wp-admin) Auto populate ACF field from another field Reply To: Auto populate ACF field from another field

  • This is the code i’ve been working with:

    function update_price_cf( $value, $post_id, $field ) {
     
       $emptyprice = get_post_meta( $post_id, 'test', true );
       $importprice = get_post_meta( $post_id, '24-month-payment', true );
    
       if ($emptyprice == '') {
          $value = $importprice;
       }
    
       return $value;
    
    }
    add_filter('acf/update_value/name=test', 'update_price_cf', 10, 3);

    It sort of works.. its doesn’t work when I import in the data. Though it did work when I did an update of the post.