• I have this code:

    $id = wp_insert_post($my_post);
    			update_field('embed_video', $embed, $id);
    			update_field('heading', trim($title), $id);
    			update_field('information', $information, $id);
    			update_field('video_length', $length, $id);
    			update_field('thumbnail_1', $thumb1, $id);
    			update_field('thumbnail_2', $thumb2, $id);
    			update_field('thumbnail_3', $thumb3, $id);
    			update_field('thumbnail_4', $thumb4, $id);
    			update_field('url', $link, $id);
    			wp_set_post_tags($id, $strTags, true);
    			wp_set_object_terms($id, $categories, 'mak_cat');
    			wp_set_object_terms($id, $stars, 'mak_star');
    			$array = array(
    			  'ID'            => $id,
    			  'post_title'    => trim($title),
    			  'post_content'  => '',
    			  'post_status'   => 'publish',
    			  'post_author'   => 1,
    			  'post_type'     => 'mak_video'
    			);
    			wp_update_post($array);

    As you can see, I automatically creating new custom post type posts. But after that I update various fields fo that post. But until I manually press Update on that post, those all fields doesn’t apply. So I added wp_update_post method, but it doesn’t work, those all fields are still not updated until I manually press Update. What I do wrong here? Or this function doesn’t do what I want to achieve?

Viewing 1 replies (of 1 total)
  • Hello dudeperfect95,

    wp_update_post is working perfect. Please check all key of update_field is correct or not.

    Thanks
    CedCommerce

Viewing 1 replies (of 1 total)
  • The topic ‘WP_UPDATE_POST doesn't work as expected’ is closed to new replies.