• Resolved ash6789

    (@ash6789)


    Hii

    I am facig an issue

    this function af_save_field saves the values

    and it is used af_save_field(‘year’, $post_id);

    what if I want to assign values manually like
    $year = 1990;

    How I can do this?
    af_save_field(‘year’, $post_id);

Viewing 1 replies (of 1 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi! af_save_field is used to automatically transfer a field value from a form to a post/user. If you simply want to save a static value or perform some changes before saving you can use the regular ACF update_field. Something like this:

    $year = 1990;
    update_field( 'field_key', $year, $post_id );
    

    ACF recommends using the field key instead of the field name for update_field if the post is new. Check out the documentation here.

    Hope this helps!

Viewing 1 replies (of 1 total)
  • The topic ‘af_save_field with value’ is closed to new replies.