Support

Account

Home Forums Bug Reports get_field() can't retrieve new post saved with update_field in ACF 4.1.8

Solved

get_field() can't retrieve new post saved with update_field in ACF 4.1.8

  • Hi, looks like there is a bug in 4.1.8. Because used the following code

    update_field('es_affiliate_price', $_POST['pin_aff_price'], $post_ID);
    update_field('es_affiliate_link_url', esc_url_raw($_POST['pin_aff_link']), $post_ID);
    

    when inserting new posts and used the following code to retrieve the field values

    get_field('es_affiliate_price', $post_id);
    get_field('es_affiliate_link_url', $post_id);
    

    It works fine in 4.1.7. But new posts inserted with update_field() from version 4.1.8 is causing the problem, because it doesn’t retrieve the values anymore using get_field(), it returns nothing. To illustrate the problem, I have compiled a snapshot here:

    https://dl.dropboxusercontent.com/u/73855680/wp-forum/ACF-4.1.8-issues.png

    Is there any new tips to fix this issue or is this indeed a bug?

    Thank you!

    Regards,
    David

  • Hi @acffan

    I don’t belive the issue is caused from update 4.1.7 to 4.1.8 as there has been no code change which would effect this function.

    However, it is possible that after the update, your code was run on a different post object, and in doing so, you spotted a bug caused by not having a ‘reference’ field.

    Please read up on the update_field function in the documentation to learn more about this hidden value which is required for ACF to work

  • Hi Elliot,

    Thanks for the tips, yes, using the key instead of field name solved the problem.

    Have a great day!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘get_field() can't retrieve new post saved with update_field in ACF 4.1.8’ is closed to new replies.