You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a new post programmatically inserted, if i user update_field() the REST API won't show ACF fields, an "empty field": false is returned, i have to use update_post_meta, no matter if i publish the post and empty the post cache.
I'm running into this as well, I've set up bidirectional relationships, and when one post type is updated, the other one's field value does get updated in WP, but not in rest APIs until the other post is re-published.
On a new post programmatically inserted, if i user update_field() the REST API won't show ACF fields, an "empty field": false is returned, i have to use update_post_meta, no matter if i publish the post and empty the post cache.
$post_id=wp_insert_post( $new_post );
// UPDATE CUSTOM FIELD
//update_field( "weight", $weight, $post_id );
update_post_meta( $post_id, "weight", $weight );
//update_field( "birth_date", $birthday, $post_id );
update_post_meta( $post_id, "birth_date", $birthday );
//update_field( "chip", $chip, $post_id );
update_post_meta( $post_id, "chip", $chip );
$file = $_FILES['photo'];
$attachment_id = media_handle_upload( 'photo', $post_id );
set_post_thumbnail( $post_id, $attachment_id );
wp_publish_post( $post_id );
clean_post_cache( $post_id );
The text was updated successfully, but these errors were encountered: