Output JSON and no theme
Output JSON and no theme
Output JSON and no theme
Usage of wp_send_json_success and wp_redirect at the same time
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)
Wrapping it in a function and then adding the following did the trick: add_action( ‘wp_footer’, ‘my_ajax_script’ ); // Write our JS below here Was all it took
Uncaught TypeError: Cannot read property ‘ajax’ of undefined
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
There is no is_home_page() function in Core. You have either is_home() or is_front_page() and you have to be careful about the two. They can be squirrelly. I don’t know which of the two functions you need but sorting that out should solve the problem, or use (is_home() || is_front_page()) perhaps.
Remove the filter wptexturize, which is what’s causing your encoding issue: remove_filter( ‘the_title’, ‘wptexturize’ ); while ( $loop->have_posts() ) { // Your code }
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
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