Support

Account

Home Forums Add-ons Repeater Field generate serialized array?!

Solved

generate serialized array?!

  • acf 5.1.7.1
    i have one repeater field with two datepickers. you see it attached.
    problem 1: i set date format both the same to Y-m-d (see 2nd screenshot). but in database it is saved in another dateformat: Ymd (see 3rd screenshot). why is it saved differently?

    problem 2: i need the data as an array. is it somehow possible to serialize it instead of inserting a new row in the database?!
    because i want the whole repeater data as one array to save it to another meta field of one post. the array should look like this:
    a:2:{i:0;a:4:{s:4:"type";s:6:"custom";s:8:"bookable";s:2:"no";s:4:"from";s:10:"2015-02-06";s:2:"to";s:10:"2015-02-14";}i:1;a:4:{s:4:"type";s:6:"custom";s:8:"bookable";s:2:"no";s:4:"from";s:10:"2015-02-21";s:2:"to";s:10:"2015-02-28";}}
    unserialized:

    array (
      0 => 
      array (
        'type' => 'custom',
        'bookable' => 'no',
        'from' => '2015-02-06',
        'to' => '2015-02-14',
      ),
      1 => 
      array (
        'type' => 'custom',
        'bookable' => 'no',
        'from' => '2015-02-21',
        'to' => '2015-02-28',
      ),
    )
  • solved! get_field() returns me an array and update_field() generates a serialized array

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘generate serialized array?!’ is closed to new replies.