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 check if post meta key exists or not in wordpress database
- How set featured posts using checkbox in post edit screen?
- How to allow hidden custom fields to be added from wp-admin/post.php?
- Convert custom fields to post categories
- How to batch update post content with custom post meta value
- Setting post meta data to random value during post status transition / on publish
- Add custom field to all posts in specific category
- meta_box or custom_field as a second tinymce post-instance?
- Create A Metabox For A Custom Field
- Paragraphs removed when using get_post_custom()?
- Does WP get all post_meta on POST page?
- Populating a page with content from post custom fields
- How to add a custom field after wp post
- Custom fields on a virtual page
- Get a custom field of all posts on current blog page
- Only display posts after current date
- How to permanently delete a post meta entry?
- How can I get a post field value using javascript?
- Automatic value for custom fields for posts
- Guest Author – How to display posts on /author/ archive page
- Get Meta Key Value While Saving Post
- 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
- MySql query to get posts with all meta and terms
- How to compare two posts including their meta fields on a scalable base?
- Getting value from get_post_custom
- Is it possible to paste a link without tags and make it directly a link in a post?
- Hooking into the post editing screen for an existing page only
- How to automate featured posts number? [duplicate]
- How to save meta checkbox WordPress
- How to calculate the average of a post meta value(Numeric) of a specific author
- Create a list of posts with topic headdings
- Add field to user meta table in database when link is clicked
- Hide custom metabox value from custom fields
- wpColorPicker – problem with implementation to post meta
- Update post meta within save_post action
- Add two custom fields as a default to the “new post” page.
- Custom permalink for each post
- How can I tell if a post has been published at least once?
- Is there a way getting post fields using `transition_post_status`
- After ajax image is outside the “ tag
- Edit custom fields in posts list
- The loop starting at a certain ID
- Simple Custom Metabox Not Saving
- Why my meta boxes won’t show in front post page?
- Will multiple category descriptions effect my search engine optimization?
- Automate post update for all posts?
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Post picker custom field on page
- Featured Images most often doesnt appear
- How to bulk Update URLs to new values?
- SQL DELETE multiple post_meta on single and multi-sites
- How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- When working with a post, almost all wp_postmeta are deleted
- Auto populate custom fields by post date
- Best Way to detect unique posts in wp rest api
- ACF Relationship – Get Parent’s Post Object
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- Add a meta to a post submited from a frontend form
- How can I set and update the the_date according to a custom field of the post
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Custom fields in normal posts
- Show posts between two Custom Fields date
- WP Query between posts custom fields [duplicate]
- How to get only current images of a post
- Ordering posts alphabetically by meta keys and title
- Run function after post is updated
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- Using Post ID and Page ID in same function
- How to only allow post to be deleted if custom field doesn’t exist
- get_post_meta property of non object
- How do I insert a custom field in a user submitted post?
- How to make a local “scroll to ID” on post?
- If meta_key exists then don’t select this post?
- How to detect if an ACF custom-field is really in use?
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- Translation related post text to Arabic