i need help with wordpress custom fields currently i store date in one custom field called audio using the “,” and “$” example:
name, link $ name, link $ etc
i have managed to use the data and split the data using php in my theme i.e the playlist.
i just need help in creating a custom metabox with 2 text fields that can be duplicated by clicking on adding more and two more fields would show. i only want to use only one custom field to store the data.
thanks
You can store an array in a custom field; WordPress serializes it for you on save and unserializes it on get.
Name your fields with a pseudo array syntax:
Youâll get a
$_POST
array:Now you can do whatever you want with it.
Drawback: Meta queries against serialized arrays are hard. Multiple post meta field are much easier to handle.