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?
- meta_query for keys that aren’t yet set
- 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
- How do I Paginate Search Results for Custom Post Types?
- 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
- order by meta_value serialized array
- 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
- Display custom post types with custom date field value (before today) & order by custom date field
- 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
- List all images from a single post meta value
- Populate Custom Fields in a Custom Post Type?
- WP_Query: include custom post type only with specific meta value
- 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?
- Meta Key Value in current-user-only loop
- 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
- How to implement a Google map store locator
- Posting to a Custom Post Type from front end – user generated content
- Update Post Meta for a logged in user
- 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
- Meta Query posts not showing on ending date of custom field
- 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?
- Possible to filter custom post type with multiple meta data?
- 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
- delete_post_meta() for whole CPT / multiple posts?
- 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
- Add a class to post_class if more than one post shares same meta_value_num
- Add a meta field to the list of results for a custom post type
- Empty meta-box returns publishdate if no value is set?
- Filter search posts by post meta?
- Custom fields for post or terms which don’t update on post update
- 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
- Meta query and compare “!=” not working as expected
- Orderby if between two meta fields
- Use WP_query to match post types based on custom field values
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- 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