I also corrected this feature by
/**
* Check if WordPress is doing ajax or not. Helpful when testing for admin
* templates because is_admin() will be true even though the user might not be
* on admin, or even logged in.
*/
function is_ajax()
{
return defined( ‘DOING_AJAX’ ) && DOING_AJAX;
}