As @milo was saying above each value that you wish to save as post meta will need it’s own call to update_post_meta. And each usage of update_post_meta will need you to specific a unique name for that meta value.
Since you have all the data in an array and you have already sanitized it you could do something like this:
foreach( $data as $key => $value ) {
update_post_meta( $post_id, $key, $value );
}
that will loop through the array and save each value and set is meta key/name to the array key you set previously in your code.
So this should work for you, but I would say that it might be worth looking at your code more to ensure all data is present before looping through the data array.
Related Posts:
- Update all posts automatically when using post_meta
- Better post meta efficiency?
- Change post format using custom field
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- What Is meta_id In wp_postmeta?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- How can I sort posts by the date and a custom meta field?
- Cannot retrieve a custom RSS field from posts
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- if in category but only with post meta
- Saving Post Data in Another Database
- saving/reading custom field value does not work – no value gets POSTed
- Post meta not working
- How do you update post date (year only) in a separate custom field?
- WP_Query sort by meta_value_num or date
- Creating Ordered Query using Meta_key
- How enter custom post meta or custom field on box post list archive page?
- How to update custom fields using the wp_insert_post() function?
- How to check if post meta key exists or not in wordpress database
- How to add category to: ‘wp-admin/post-new.php’?
- How to protect pages with double authentication: password + email (in custom field)
- How set featured posts using checkbox in post edit screen?
- How can I retrieve multiple get_post_meta values efficiently?
- Code to make a post sticky
- How to allow hidden custom fields to be added from wp-admin/post.php?
- Add a checkbox to post screen that adds a class to the title
- Custom Field in Featured image for A particular post
- Export WordPress Posts and Meta Information in CSV format
- Delete duplicated wp_postmeta record
- Convert custom fields to post categories
- Will a large postmeta table slow a site down?
- How to batch update post content with custom post meta value
- Change slug with custom field
- I am trying to create a simple frontend form for posting
- Prevent duplicate posts in wp_insert_post using custom fields
- HTML code in Custom field
- How to show posts rank based on custom field value
- Setting post meta data to random value during post status transition / on publish
- Add custom field to all posts in specific category
- Adding a Nav menu to post admin
- meta_box or custom_field as a second tinymce post-instance?
- Edit meta data does’t work with custom sql
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Create A Metabox For A Custom Field
- Paragraphs removed when using get_post_custom()?
- Human Time Diff, change mins to minutes
- get_post_custom stripping styling issue
- Does WP get all post_meta on POST page?
- Populating a page with content from post custom fields
- How to change what the post creation page looks like?
- How can I make existing custom fields easier to edit/add in my theme?
- Exporting Data from WordPress into a flat table
- Adding Multiple Values to a Post Meta Key
- Add custom fields to post programmatically
- How to get Advanced Custom Field Value According using POST ID? [closed]
- Using radio button meta data from a custom meta box
- Autoremove empty custom fields
- How to add a custom field after wp post
- Custom fields on a virtual page
- PHP Notice error (when on 404 page)
- Get a custom field of all posts on current blog page
- Only display posts after current date
- Checking if a post with certain meta value exists
- How to permanently delete a post meta entry?
- Global $post not working in OOP function WordPress
- How can I get a post field value using javascript?
- Automatic value for custom fields for posts
- How to generate numbers indistinguishable for the IDs of the posts
- Modify WP_Post before processing
- Understanding and using metaboxes in posts
- Save re-arranged draggable post items to wordpress database
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Change post_date to post_modified date on post template?
- Duplicating Table of Contents for Paginated Post
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Guest Author – How to display posts on /author/ archive page
- WP_Query orderby not working with meta_value_num and menu_order
- is there a way to show the the post title after the image?
- Get Meta Key Value While Saving Post
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- How to display Common posts from specific Tag & Category with Shortcode
- Update Post Meta for a logged in user
- Two Custom Post Types Many to Many Relationship
- Force the “Choose from the most used tags” meta box section to always be expanded
- Automatically add custom fields value to wordpress post
- Meta value does not save for scheduled posts
- Custom Posts Query and meta_query Sort Order
- Is there a way to notify specific users when new posts are published to specific pages?
- MySql query to get posts with all meta and terms
- How to compare two posts including their meta fields on a scalable base?
- Categories list into registration form
- Getting value from get_post_custom
- Add a custom meta box in the post options that loads some html code in the header
- Calling Different Custom Post Timestamps in a table
- Is it possible to paste a link without tags and make it directly a link in a post?
- Query Posts With Over 1000 Views
- Saving custom fields to a custom taxonomy
- Hooking into the post editing screen for an existing page only
- Query Posts by Custom Field