Support

Account

Home Forums Backend Issues (wp-admin) Update a field when duplicating a post Reply To: Update a field when duplicating a post

  • Ok, I figured out that this could be achieved by resetting the value to false (no) after a product is published. That way the duplicate is loaded with No selected.

    This code works, but please let me know if I can improve upon it. Thanks.

    function reset_product_readiness_after_publish( $post_id ){  
        $value = "0";
        update_field('field_30705432c7518', $value, $post_id);
    }
    add_action('acf/save_post', 'reset_product_readiness_after_publish', 20);