I have this kind of data on my database:


    <wp:meta_value> <![CDATA[a:2:{i:0;a:2:{s:4:"feed";s:86:"https://www.example.com/ics-files/property.ics";s:4:"name";s:20:"IMPORT_1";}i:1;a:2:{s:4:"feed";s:56:"https://www.example.com/ical/property.ics";s:4:"name";s:16:"IMPORT_2";}}]]>

As you can see, on meta_value I have two pairs of serialized data "name1/feed1" and "name2/feed2".

I wish to add, via custom fields, more instances to that array "name3/feed3)". But I don't know how to do it.

I was able to retrive the data so far:

    $property_icalendar_import_multi = get_post_meta($edit_id, 'property_icalendar_import_multi', true);

            foreach($property_icalendar_import_multi as $key=>$feed_data){
                print $feed_data['name'];
                print $feed_data['feed'];



My question is now, how can I update (edit or add) this data with a metabox?

I know I have to use update_post_meta but I'm not sure how.

Can someone point me on the right direction?

  • How this data being saved? Do you already have a metabox for that?
    – Abhik
    May 21, 2022 at 7:06
  • I need to create the metabox but I don't know how to adapt it to my needs
    – Peanuts
    May 21, 2022 at 15:09
  • This will help you to get started.
    – Abhik
    May 21, 2022 at 16:11
  • Ok thanks, my problem is I can create an "average" metabox to updat a "classic" plain custom field, but I don't know how to create a metabox that can update KEY/VALUE and append new information to the table...
    – Peanuts
    May 23, 2022 at 2:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.