In my plugin, I'm using wp_ajax, This hook does not work when I wrap the init function call with a condition like this :
public function __construct(){
if( isset( $_GET["page"] ) && $_GET["page"] === 'edit-foo' ){ <-- This line prevents the call 'wp_ajax_foo' !
add_action( 'admin_init', array($this, 'init') );
}
}
init(){
... <- initalize $this->editable_item->item
add_action('wp_ajax_foo',array( $this->editable_item->item, 'foo' ) );
}