You are accessing the $_POST array in a wrong way. This is not possible:
$_POST['imagefields[' . $i . '][image2]']
Correct way would be:
$_POST['imagefields'][$i]['image2'];
(You have the same mistake when accessing the $values
array.)
Also you are supposed to give the complete array to the update_post_meta()
function instead of saving each value seperately:
if(isset($_POST['imagefields'])) {
update_post_meta($post_id, 'imagefields', $_POST['imagefields']);
}
*EDIT*
You can see if the values where saved to post_meta correctly using this code:
$values = get_post_custom($post->ID);
var_dump($values);
To fix the $values part you need to change all occurences of:
$values['imagefields[' . $i . '][image1]']
To:
$values['imagefields'][$i]['image1']
Related Posts:
- Adding another state (spam, reject, approve) to wordpress comments?
- Problem in custom meta boxes
- Multiplile values checkbox or select in custom meta box
- Better Method for Multiple Meta Boxes
- I need a “Choose from existing content” popin
- How can I hide custom field from users used for caching response from external api?
- Let’s Create Custom Field Template Documentation
- MetaBox not saving after empty
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Make separate text boxes for separate WordPress Custom Fields
- Save input form on custom field
- When post is updated, custom metadata in text area field is overwritten
- ‘Preview Changes’ for custom meta boxes?
- Using TinyMce with textareas in meta boxes on custom post types
- add meta box – custom field : which to choose?
- Add metabox to document tab in gutenberg
- Add custom objects/entities to WordPress
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Add custom option to Standard Page Attributes Meta Box
- Only show metabox when date-value in other metabox is over?
- Making a configurable field translatable
- Populating meta box with select-list of existing posts, and assigning it to custom post types
- Create meta boxes that don’t show in custom fields
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- Custom Fields Bulk Edit
- Custom Page Template [closed]
- wp_editor in add_meta_boxes does not show gallery
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Problem with adding exta field in metabox in custom post type
- Adding a custom field or metabox to the post-thumbnail widget?
- How do I add custom_meta_box_id’s value?
- how to save multiple custom fields for a post in one go?
- Best way to add custom / magic / flutter fields into RSS feed
- My metabox class
- Loading scripts to the Post Edit page only
- Woocommerce with metabox plugin
- How do you create dynamic customised sections in WordPress?
- Dynamically add / duplicate custom meta in custom post types
- How to check for specific meta box value on front end and output accordingly
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- Tweak Meta for Post to work it for Pages also
- Create Multiple File Upload Metabox in WordPress
- Users Select inside custom metabox
- Custom Metabox Not Saving
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- How to make condition, based on custom fields value?
- How to select posts from multiple categories and metavalues?
- Custom Meta Box (SELECT) Not Saving
- Get updated meta value after post update or published (custom post type) using hook
- Why is my Custom Meta Box Field Inputs NOT saving?
- custom-meta-box checkboxes from loop won’t save
- For homepage images (for small business website), is it better to use custom fields or post_thumbnail?
- Outputing a metabox textarea and avoid line breaks inside li tags
- shortcode in a custom metabox
- Problem with saving large amount of data in postmeta/usermeta
- Move Title and the Content WYSIWYG editor position
- How to use media upload on metabox post page without breaking TinyMCE?
- How to query an out put value?
- Displaying Meta-Box Data Properly
- frontend submit post jQuery clone row won’t save
- Can I save post meta programatically without setting metaboxes?
- Let author add field to metabox by pressing a button
- Get text from user and display it on page
- Custom Fields Question
- Meta box values are displayed on Custom Fields list. Is it possible to hide them?
- If metabox has content display content
- Get meta field value of all catgories
- How to get all custom fields with some prefix in key?
- How to store meta field values
- How to Convert Custom Fields from Text to Array?
- Adding re-type email and check it if the email match
- Approach to creating a site with this structure
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Set class if a meta value is set within post archive
- Using Customizer API vs Custom Meta Box for custom content
- Allow HTML in Custom Metabox area
- Metabox/Custom fields are not saving input data
- Custom field metabox not showing in back-end
- WordPress admin area: select box with 12.000+ options
- Remove Custom metabox from particular page template is used
- How to display selected option from dropdown list in a metabox
- Save, update, get and sanitize post meta as HTML not plain
- Update custom table on metabox POST
- Metabox value for post loop?
- how to modify a field’s size in a metabox : ROWS height, and scroll control?
- Append custom field items to content from plugin
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- Extend WP_Customize_Control with Multiple Field Control
- custom field functionality
- How to add an option to admin to add image that could be used as header?
- Show or hide lang=”ur” in main element
- How can I create more “create attachment” custom field – any idea?
- Can i categorise my meta box?
- Custom Metaboxes, multiple post selection
- added a meta box to post however when saving menu while debug on throws a warning
- When editing a post with a custom meta box the values aren’t displaying correctly
- How to get the value of particular get $meta value in wordpress
- Display custom field value into content with hyperlink
- Add image custom attribute [closed]
- Add fields to edit in custom widget