This should work out of the box, as long as the “unique” parameter of add_post_meta()
is false
.
add_post_meta($id, '_dates', 2, false);
add_post_meta($id, '_dates', 3, false);
add_post_meta($id, '_dates', 4, false);
then somewhere else
$dates = get_post_meta($id, '_dates', false);
Now $dates
should be an array of your 3 values.
Related Posts:
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Show posts from WP Custom Post Type selected from a field in a metabox
- Querying meta values within an array
- Check for custom field value in different post type than current one and do something
- what is the correct way to compare dates in a WP query_posts meta_query
- Advanced search form with filters for custom taxonomies and custom fields
- Using meta_query, how can i filter by a custom field and order by another one?
- Custom field values deleted when trashing custom post type
- How to get all custom fields of any post type
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Ordering posts having multiple post-meta date fields
- Querying custom post type with 2 custom fields (date-range)
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- I can’t set meta_key in my custom post type query
- Can’t sort order of wp_query with 2 meta keys
- How to get source of custom meta image?
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Displaying Meta Box Image
- How loop through posts based on custom fields
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Displaying Metabox value (custom post type taxonomy)
- Filtering by Post Meta Custom Fields – Performance
- Create a random unique 6 digit number as custom field for custom post type
- how to interconnect custom post types?
- meta_query compare >= not working but
- Populate Custom Fields in a Custom Post Type?
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How to check if user meta field is empty in conditional else statement
- wp_query check if integer exists in custom field’s array
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Get posts between custom dates
- Posting to a Custom Post Type from front end – user generated content
- A better way to add a meta box to custom post types
- Two Custom Post Types Many to Many Relationship
- get_post_meta not working on publishing
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- Importing Data from a Non-WordPress database, into WP
- filter search custom field query
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- Custom fields for custom post type
- Check if post with same meta value exists
- Submitting Custom Post Types with custom fields from Front-end form
- create custom meta box with default value
- How to get specific post meta by title or id
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query of custom post type sorted by meta_key has unexpected results
- copy images from custom field to another custom field
- Custom Query: If One Post Object Field Value Is The Same As Another
- How to show custom field on specific custom post type posts only when filled
- Cannot obtain custom meta information
- How can I output WPAlchemy repeating fields meta values in my page template?
- How to call a post’s metadata in shortcode.php?
- WP_Meta_Query object with conditionals
- delete duplicate meta_value with same post_id
- Search CPT Title AND Meta
- updating one custom meta field only
- Empty meta-box returns publishdate if no value is set?
- Filter search posts by post meta?
- order the meta query results by 2 custom fields
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Using OR relation in meta_query to check for a value before sorting by another
- How to keep custom post type related information
- Orderby if between two meta fields
- Use WP_query to match post types based on custom field values
- Where is get_post_meta value located?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- Add more custom fields when creating a new custom post type
- How do I extract the contents of a CPT’s custom field for all posts?
- Query events post type after current date and timezone
- Delete custom post type metadata without deleting the post in admin area
- How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
- How to add post reference field to a plugin?
- meta query always fails even if data is correct
- Selecting posts older than the current Unix epoch timestamp
- Unable to get the upcoming events for custom post
- Advanced search form with filters for custom taxonomies and custom fields
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- loop through custom post-type with two meta_keys
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Display a list of posts whose meta field values are equal to the ID of the post being viewed?
- Function to Compare CPT Post Custom Value with Default Posts CF Value