WordPress ajax action not working when we add admin_init redirect action in wrong way. To make it work we must need to add condition to exclude ajax file like ($_SERVER[‘PHP_SELF’] != ‘/wp-admin/admin-ajax.php’)
Below code is working well to exclude all non administrator redirect to my-account page and ajax action is working well.