Save field values
Parameter |
Required |
Type |
Notes |
field_data |
Y |
array |
An associative array of field data |
$post_data |
Y |
array |
An associative array of post data. To update an existing post, set $post_data['ID'] |
$post_data
can include other post attributes, such as:
Return Value
(int) The post ID
Examples
Update an existing post
Create a new post, and attach some custom fields
How to structure $field_data
for loop fields
Copy custom fields from one post to another (using ‘format’ => ‘raw’)