Wp ajax call returns 0 at the end

August 23, 2012 | | Blog |

To any wp ajax call

add_action('wp_ajax_my_action', 'my_action_callback');

function my_action_callback() {
//Do action
// echo 'My ajax action';
die();
}

Don’t forget to add the die() at the end of ajax function to avoid 0 with the results.