How-to debug wp_ajax_* hook callback?

The answer was as stupid as simple: I wrapped the init for the class in a ! is_admin() call. This successfully prevented the callback from beeing fired.

Rule for AJAX loading

  • Load it in public
  • Don’t hide it behind a ! is_admin() call.

The 2nd line from admin-ajax.php

define( 'WP_ADMIN', true );

Leave a Comment