Create a file format (csv,json,etc) when save/update a Post

There are a number of action hooks for Post Status Transitions. They each receive the $post object as an argument. You could use these to trigger a function that writes your file to disk using fopen. Edit: if you’re writing CSV, PHP has a function specifically for that: fputcsv (fopen still required)

Result from wp_send_json adds line feed

Well that was tricky. This was the offending code that was generated a line feed to the response. add_action(‘wp_ajax_nopriv_display_event_info’, ‘DisplayEventInfoBox’); ?> <?php function displayStepHeader($isValid, $pos) I changed it to add_action(‘wp_ajax_nopriv_display_event_info’, ‘DisplayEventInfoBox’); function displayStepHeader($isValid, $pos) and all is well. I have no idea why that was an issue but how I tracked it down may be … Read more

Ajax contact form returnig 0

What makes you think this will ever be true? if (isset($_POST[‘submit’])){ In function dav_form_validation the die() is in 2 conditionals. It should be called regardless of whether the conditionals are satisfied. Add 2 else clauses and return error messages. Usually a response of ‘0’, means the ajax hooks are not being found. But your code … Read more

WordPress Ajax JSON success return no being recognized

You are not giving the action name to your AJAX call. In WordPress, you have to give an action name, the same name you give whatever is after wp_ajax_ and wp_ajax_nopriv_ In this case, the AJAX call should work if you change the data: inside your AJAX call, for this: data: {action: “contactform_action”, values: $(‘#contact-form’).serialize()} … Read more