How can I process xml file on upload?

I solved my problem with lots and lots of testing things out. Apparently my FormData Object was not correct. Doing these changes to my code worked: $(‘#xml’).on(‘submit’, function(e) { e.preventDefault(); var form_data = new FormData(this); form_data.append(‘action’, ‘calculate_xml’); $.ajax({ url : ajaxurl, type: “POST”, data : form_data, processData: false, cache: false, contentType: false, success:function(response){ $(‘#response’).html(response); }, … Read more

Problems with creating hook that updates XML

The 1 character output error is probably because you have a single space before <?php or after ?>. As far as it not doing anything, where is the fruits.xml file? this line: $xml->load(‘fruits.xml’); in this context is looking for the file at: /your/server/path/to/wp-admin/fruits.xml Which I assume is not what you’re expecting. Have a look at … Read more

Create XML files on post edit screen

If you’re using XML to send Ajax requests, then WP has something built in: $response = new WP_Ajax_Response(); $response->add( array( // This is the parent elements name ‘what’ => ‘xml_parent_el’ // ‘data’ can only pass CDATA ,’data’ => $foo // ‘supplemental’ can only pass elements with a unique name ,’supplemental’ => $bar ) ); $response->send(); … Read more

How can I export post data in xml format?

I just want to make my own exporter Well, export_wp() will fetch the data (it builds the sql query, I think). So I’m not sure the benefit of using an api request to try and hand that data to export_wp(), unless you mean to generate the arguments for it via an endpoint, or some values … Read more