Just save the array to post meta as you save string-
$data = array("200", "201", "202");
//Update inserts a new entry if it doesn't exist, updates otherwise
update_post_meta($post_ID, '_parent_id', $data);
The for getting the post call get_post_meta
like below-
get_post_meta($post_ID, '_parent_id', true);
You’ll get the array. Then run for
or foreach
loop to show the array data as you want to show.
Related Posts:
- Get posts by meta value
- How get post id from meta value
- Safe to delete blank postmeta?
- advanced custom fields update_field for field type: Taxonomy
- update_post_meta not saving when value is zero
- Restrict post edit/delete based on user ID and custom field
- get_post_meta returning empty string when data shows in the database
- publish_post action hook doesn’t give post_meta_data
- Remove post meta keys
- How to access the post meta of a post that has just been published?
- delete unused postmeta
- Query between two meta values?
- Using Advanced Custom Field (ACF) to insert meta description on each page
- loop through all meta keys with get_post_meta
- How to add meta tag to wordpress posts filter?
- Correct processing of `$_POST`, following WordPress Coding Standards
- Metabox Data not being saved [closed]
- Options to get my custom post type metadata via the WordPress API
- Generate an Email address from that of the Post Author
- How to get the total number of meta_values based on a custom post type?
- Saving html into postmeta without stripping tags – safe?
- Does “update_post_meta” check if value is the same before updating?
- Add a meta value if admin , editor or any other user have open a post in edit mode
- How to show Published date and/or Modified date
- wp_update_user isn’t instantly?
- Finding the page id
- WP_POSTMETA – What do these values mean inside the data structure?
- Update Line Item Meta Data – WooCommerce API
- How to use update_post_meta inside wp_trash_post
- “update_post_meta” not working in “wp_insert_post_data” hook
- Unset field from an array not working as expected
- Update post_meta with WooCommere variation data
- What type of index should I use for postmeta?
- How to create a meta_query to get all posts with a specific meta data?
- hide posts with specific meta data from admin page
- Post MetaTable Overload
- get_post_meta() empty in preview WHEN custom post is published [closed]
- Custom RSS Feeds & Post Meta Data
- Add Embed.ly API objects to post_meta on update
- Editing does not change post_name
- get_post_meta not extracting title,permalink and posttype
- How to selected which tags to print, instead of printing the whole tag list?
- Display get_post_meta if contains value
- Save post meta foreach loop
- Should I save this mulit dementional arary as one post meta?
- Sort Posts By Custom Field Date?
- Difficultly changing date format in post meta value
- Remove last character in get_post_meta
- mass delete posts based on metadata
- How to obtain a group of post meta and assign each meta to other variables?
- “Cannot use import statement outside a module” JS error while adding a custom meta block?
- Duplicate rows in meta table, any known relations in WC?
- Adding Custom MetaData
- Suggestion to make posts have multiple associated items
- How to properly use oneOf and anyOf in Rest Schema?
- update_post_meta in loop changing ALL values
- wordpress is_front_page() issue
- Why is my get_post_meta not properly calling the custom field when attempting to embed a YouTube video?
- show ad after # paragraphs
- How to echo value of a meta select box to the browser
- How can I use ‘orderby’ => ‘meta_value_num’ to order by the numerical value even if the value starts with a word?
- New Table vs Post / Comment Meta
- Randomizing Post Links Outside of Loop – No Author or Date
- help to decipher wp metadata
- How do I add a fixed value to get_post_meta();?
- Add post’s category as a meta tag to the post
- How can I query for posts using a date stored in post-meta?
- SQL query – get a featured image’s alt / alternative text
- I can not display meta value in extras.php and template-tags.php
- update_post_meta() updating nested array in Multidimensional array with empty sub-array
- get specific values from WordPress meta_value
- Is duplicate `_wp_attachment_image_alt` meta key allowed?
- Sorting my posts on homepage my specific value in post_meta table
- How can i set media attachments to the author of the post or page for already existed posts with attachments
- How to get posts by meta value as multi-dimensional array?
- Add post meta data date to event
- Check if any meta on the post has value then display content
- How to modify default meta link format
- Something adding an excessive meta description
- How can i show post views using specified post ID?
- How to add/update post meta to use in query?
- gettext localization is not working
- how to query posts using value in meta post array
- Why doesn’t wp_oembed_get() for the video post format not work?
- Custom Meta Fields that are Echo’d are removed on post update?
- How to add dynamic content in title and meta description in wordpress theme for homepage, post page, category, tag and pages
- How to call get_post()?
- add_post_meta only adding 1 character
- How to sort by meta value num, but ignore zero value?
- Create a Gallery and update Post Parent of Attachment Images
- Posts with no meta field do not appear when sorting by meta field
- How do I delete element from a serialized array upon deletion of a post?
- How to create a link for wordpress meta datas?
- Which query method to use? (edit- wpdb syntax problems)
- Get meta information from post parent
- How to update post meta with xml data
- Counting number of identical meta keys
- query with custom field
- Using Form to alter PHP variable [closed]
- Chance post id into post name