Home › Forums › General Issues › Populate XML file with ACF custom field data › Reply To: Populate XML file with ACF custom field data
Thanks Hazard that was closest to the solution.
I created an archive-custom-pt.php and used $title= get_field('title');
to populate the XML document.
Sample idea
$doc = new DOMDocument('1.0','UTF-8');
$doc->formatOutput = true;
$doc->preserveWhiteSpace = false;
$root = $doc->createElement('Book');
$root = $doc->appendChild($root);
// Title
$title = $doc->createElement('title');
$title = $root->appendChild($title);
$doc->save("books.xml");
The only issue i have now is it will write the post custom field data to the books.xml but only a single post and not all the posts.
Thank you for your help!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.