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


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

    • acffan

    • July 11, 2013 at 8:03 am

    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:

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

    Thank you!


    • Elliot

    • July 11, 2013 at 3:08 pm

    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

    • acffan

    • July 11, 2013 at 3:40 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.