If you want to store an array in one meta_key, you need to add your different keys in the input name. For my example, this is the retrieve way where you need to be in a foreach loop where $i is increment with $i++ in it. To save value you will need to modify your name input with [‘imageUrl’][] and [‘imagetxt’][].
$imageset = get_post_meta($post_id, 'imageset', true);
$i=0;
foreach($imageset as image){
echo '<input type="hidden" name="imageset['.$i.'][imageUrl]" value="'.$imageset[$i]['imageUrl'].'"/>';
echo '<textarea name="imageset['.$i.'][imageTxt]">'.$imageset[$i]['imageTxt'].'</textarea>';
$i++;
}
I didn’t test it to ajust to your whishes, but I’m sure you’ll get it !
Related Posts:
- Advanced search form with filters for custom taxonomies and custom fields
- Meta query with boolean true/false value
- Custom field values deleted when trashing custom post type
- How to get all custom fields of any post type
- Update CPT meta data using REST API
- Echo all meta keys of a custom-post TYPE
- How do I remove all the metaboxes for a custom post type?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Gutenberg how to make attribute to save to meta
- Get all posts from custom post type and insert in select input as metabox
- Custom Post Type: Set post_title equal to a custom post type field
- I can’t set meta_key in my custom post type query
- WordPress Admin Panel search posts with custom post meta values along with title
- How to Update post status using meta data in Custom post TYpe
- Rest Api v2 orderby meta_key in custom post type
- bulk Update post_meta with default values
- How do I sort a custom post type admin column using two meta keys?
- Add Post Url to Manage Edit Screen
- How can I display my custom metaboxes on a custom post template?
- Display all custom post type posts and order them by an optional meta_key
- How can I get_post_meta() in the most efficient way?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- how to interconnect custom post types?
- Custom Post Status Transition Issues With Get Post Meta
- List all images from a single post meta value
- Show the same Article Available in Other Categories
- how to delete all users and posts based on ‘user_meta’?
- Meta Key Value in current-user-only loop
- How to set YouTube video as featured image?
- How to implement a Google map store locator
- Widget: Custom Post Type Post Listing Dropdown on Admin Side
- How do I create an archive page as a including metadata?
- Update Post Meta for a logged in user
- How to duplicate entire custom post type
- get_post_meta not working on publishing
- how can I register a post_meta field in an existing CPT and then call it again with get_post_custom()?
- get_post_meta returning no value in custom post type alert email
- Update postmeta Parent when post_status child change
- WordPress request fiter order by related post’s post_title
- Dynamic Custom Fields
- Show Custom Post Type meta boxes only on Page Edit
- Getting thumbnails of a custom posts featured images in a page-templates metabox
- Remove Post Custom Meta Box
- Using preg_replace to filter custom textarea
- If Post Meta Equals Current Title Conditional Advanced Custom Fields
- Archieve.php not loading for custom post type
- Meta data (Tags and Categories) for Custom Posts not showing.
- Display different information of a custom post type
- Create Array from custom post type to display a slider
- delete_post_meta() for whole CPT / multiple posts?
- How to get specific post meta by title or id
- How can I display a drop-down select of Post Names
- how to show records that don’t have custom meta value
- $post->post_meta not pulling any post in wordpress/php
- WP_Query of custom post type sorted by meta_key has unexpected results
- copy images from custom field to another custom field
- Get all metadata for a given custom post type
- Advanced custom field – posted fields from custom post type
- delete duplicate meta_value with same post_id
- Search CPT Title AND Meta
- Add a class to post_class if more than one post shares same meta_value_num
- Function to return values from metabox
- Add a meta field to the list of results for a custom post type
- Building tags and archive using meta from custom post type
- Filter search posts by post meta?
- Custom fields for post or terms which don’t update on post update
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Add a form in every post and save data in post meta
- How to use multiple Meta Field from CPT as Post permalink
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Attaching more than 1 parent (Post) to a media file
- 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
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- How to get post by meta value
- Get meta values from parent post and save in child post
- How do I get all authors posts of a custom post type outside loop
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- How to get post detail based on URL of the post
- Custom post type meta fields missing on save_post_type
- Linking posts together with Advanced Custom Fields “both ways”
- Order posts by meta value hiding posts instead of re-ordering
- custom search results – order results differently by post type
- How to get post meta for custom post type and taxonomy
- get_post_meta for Custom Post Type ( CPT )
- Delete custom post type metadata without deleting the post in admin area
- Order by post meta value gets random results
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- How to create content automatically when a post is published?
- Rich Custom Field for Custom Post type not saving
- Add auto increment value to custom meta
- Return only custom post types for the page, not all
- Retrieve post data via WPDB class
- Create action running on trashed_post hook to modify post_meta value
- Random meta field from specific custom post type
- Custom Post Type meta value is being saved in array, instead of just the string (as value)
- Custom Form Data save after Login User
- Post Meta for Custom Post Types
- getEntityRecords/useEntityRecords: How to use CPT metadata?
- CPT meta values intermittently return empty