Great thanks Joel Now its working properly. I just made following changes to my function are:
Before:
add_action( 'init', 'blockusers_init' );
function blockusers_init() {
if (!current_user_can( 'manage_options' )) {
if (is_admin()) {
wp_redirect( home_url() );
exit;
}
}
}
After:
add_action( 'init', 'blockusers_init' );
function blockusers_init() {
if (!current_user_can( 'manage_options' )&& $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php') {
if (is_admin()) {
wp_redirect( home_url() );
exit;
}
}
}