I'm using the ACF plugin for WordPress. I'm posting to a custom post type programmatically via my theme. Now, I thought I would be able to save an array of items to a custom field quite easily, but whenever I try to, nothing gets input. I simply get this error when I check the post screen in the admin area:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/lukeseag/public_html/spidr-wp/wp-content/plugins/advanced-custom-fields/core/fields/text.php on line 127
Now, I'm kind of throwing this out there for suggestions as to how I can go about solving this problem.
To give some context, I'm programmatically saving data input by a user, and creating a post with it. Much of the data is simple strings and numbers that can each have their own custom field.
But I have an unknown number of text strings
and URL's
(with an id number for each) coming through this page too, that need to be linked with the same post. I need to be able to output each set of text string
and URL
into their own div on the single.php
post page. Now, ideally these text/url pairs would be saved in a single array so I can just loop through the array and output the data, but it looks like ACF doesn't want to let this happen?
Any suggestions as to how I can save this data and then output it easily on the single.php
page? Each set of results will have an ID
(number), text string
and url
.
Thanks!