Support

Account

Home Forums Front-end Issues Issues with ACF updating fields after creating new post

Solved

Issues with ACF updating fields after creating new post

  • I am using ajax to create a new post and all works fine. However i am not able to update any ACF fields as they are undefined initially. The only way i can resolve it is to go into the back end and hit update manually on the post. On doing so the ACF content becomes available to access from the front end and so updateable.

    I’ve tried adding each of the below in the create post function to see if it might help, but no such luck:
    do_action( ‘acf/save_post’, $new_post_id );
    update_post_meta( $new_post_id );
    wp_update_post( $new_post_id );

    Anyone have ideas how to overcome this problem programatically?
    Thanks in advance

  • I had to resolve this by “updating” the fields in the function where i was creating the post. This then “Activated” the fields and allowed them to be updated.

Viewing 2 posts - 1 through 2 (of 2 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.