WP AJAX is not working, always returns 0
The problem is where you place the add_action of your wp_ajax_* Try to put it at the start of everything, and ensuring that it is being loaded in a /wp-admin/ route. Try your url: http://xxx/wp-admin/admin-ajax.php?action=your_action until it gives you something different than zero.