I'm trying to export my posts from a custom post type to a csv file. The point I'd like to get back at later is that my posts have custom fields created using the Advanced Custom Fields plugin.

I found that this can be done by writing a database query and even found various plugins which could get me all the details. The problem I'm facing is that one of the custom fields in my post is 'Relationship post object' field and whichever method I use to export the posts as CSV give this post object field values as an array. Is there a way to get the actual content as it is outputted on the frontend?

1 Answer 1


Lol. I got reminded of this question when I got the Tumbleweed badge for having no answers and low views for a week.

I didn't figure out the right method for this but hacked through it by printing out the posts in a table format on the archive page for this custom post type and used a jQuery script from: http://www.jqueryscript.net/table/Export-Html-Table-To-Excel-Spreadsheet-using-jQuery-table2excel.html to output the table into excel format. Not the cleanest method 'cos I found some values weren't formatted as proper cells but had to use this method since this was an urgent requirement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.