How to export serialized data from WordPress

I use Advanced Custom Fields and ACF Repeater field plugins for WordPress, and I’m having problems getting serialized data in SQL and Excel.

I build a base of children for Russian medical institutions. It was planned so worker from institution can add child to database and add services that child got there. So these are checkboxes for services.
Key function for me is repeater field, which allows to create new amount of services.

Read More

Close to the problem. In database it is saved serialized, like this. I export posts and meta to Excel using an SQL query and I get this serialized data there too. Query:

SELECT DISTINCT
post_title
,(SELECT meta_value FROM kr_postmeta WHERE kr_postmeta.meta_key = 'birth_day' AND kr_postmeta.post_id = kr_posts.ID) as "birth_day"
FROM kr_posts
WHERE post_type = 'post' 
GROUP BY post_title
ORDER BY post_title DESC

And I can’t even say what I expect to see as a solution, all of them seem to be impracticable. It might be:

  • Changing way of writing multiple data in ACF, so I don’t get serialized data.
  • Enhance export to get unserialized data.
  • Unserialize data in CSV file.

Related posts

Leave a Reply