Support

Account

Home Forums ACF PRO Best way of merging fields?

Solving

Best way of merging fields?

  • Hi

    I have 3 fields that output like this

    a:3:{i:0;s:3:”157″;i:1;s:3:”156″;i:2;s:3:”155″;}

    How can i merge them into 1 large array such as this

    a:3:{s:4:”tags”;a:4:{i:0;a:1:{i:0;s:2:”32″;}i:1;a:1:{i:0;s:3:”100″;}i:2;a:3:{i:0;s:3:”141″;i:1;s:3:”138″;i:2;s:3:”142″;}i:3;a:1:{i:0;s:3:”137″;}}s:7:”numbers”;a:4:{i:0;s:1:”4″;i:1;s:1:”2″;i:2;s:1:”3″;i:3;s:1:”1″;}s:5:”marks”;a:4:{i:0;s:1:”1″;i:1;s:1:”1″;i:2;s:1:”1″;i:3;s:1:”1″;}}

    Thanks in advance

  • I’m not sure how you are getting these values, but you cannot merge them as strings.

    You need to unserialize each array, merge the arrays and then serialize the result.

  • How do i make an array in acf and then merge and serialize?

  • I have no idea, I don’t even know how you’re getting that value to save. Usually when a value like that is retrieved from the db it is automatically unserialized into an array.

  • The values are from checkbox fields

    There are 3 different checkboxes that have various options to choose. It is this data that i would like to merge

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

You must be logged in to reply to this topic.