I have a custom post type product
using ACF (Advanced Custom Fields)
I would like to schedule a daily cron task automation to export all published
posts into post_id.txt
, one for each post.
I know there are plugins that can export custom post type and ACF to CSV or XML.
But my requirement is a more customized task.
A simplified example, the format of the output file post_id.txt
should be and each field separated by \n
:
eg. 1234.txt
POST_TITLE
PRODUCT_IMAGE(ACF URL FIELD)
CATEGORY
TAGS
CONTENT
I can access all these information in the template loop, but how do I write a function to export them as the above job requirement?
Any pointer and direction of where to begin is appreciated.