Home Forums General Issues Updating Post Values Reply To: Updating Post Values

  • Your first error is that when updating post meta using wp_update_post() your meta values need to be in a nested array, example: (see

    // Update current post with new preview link
        $postInfo = array(
            'meta_input' => array(
                'field_5cf1142a132e8' => $url
            'ID' => $postID

    your second issue is that when updating fields in this manner you’d need to update 2 fields. One using the field name that holds the value and the second is the field key reference. The meta_key of this other field is "_{$field_name}" and the value of this field is the field key of the field you are updating.