custom post type information missing when creating new post programmatically
-
I am creating a new post programatically from the front end successfully using
wp_insert_post($new_post);
However my problem arises when trying to access content from custom fields, in this case ACF fields. I cant seem to access the data until I have manually updated the post in the back end. Is there a way to programmatically update the post straight after creating it in exactly the same way as the update button on the back end? I have tried adding the below with no success:
do_action( ‘acf/save_post’, $new_post_id );
update_post_meta( $new_post_id );
wp_update_post( $new_post_id );Any help appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘custom post type information missing when creating new post programmatically’ is closed to new replies.