
https://domain.com/sitemap_index.xml
và gặp lỗi như ảnh trên, thì đừng quá lo lắng. Cảnh báo lỗi này nghĩa là website đang gặp phải các lỗi trống hay khoảng trắng tại vị trí được cảnh báo (error on line 3 at column 6). Để khắc phục nó, bạn chỉ cần làm theo các bước bên dưới là được nhé.Bước 1: Tạo file whitespacefix.php
Đầu tiên, bạn hãy đăng nhập vào Hosting/VPS của bạn. Tiếp đó, bạn di chuyển vào đúng đường dẫn chứa dữ liệu website và tạo mới một File mới và đặt tên làwhitespacefix.php

<?phpfunction ___wejns_wp_whitespace_fix($input) {$allowed = false;$found = false;foreach (headers_list() as $header) {if (preg_match("/^content-type:\\s+(text\\/|application\\/((xhtml|atom|rss)\\+xml|xml))/i", $header)) {$allowed = true;}if (preg_match("/^content-type:\\s+/i", $header)) {$found = true;}}if ($allowed || !$found) {return preg_replace("/\\A\\s*/m", "", $input);} else {return $input;}}ob_start("___wejns_wp_whitespace_fix");?>

Bước 2: Include vào index.php
Tiếp đó, cũng tại đường dẫn chứa dữ liệu website bạn chọn Edit Fileindex.php
và thêm đoạn bên dưới vào:include('whitespacefix.php');

https://domain.com/sitemap_index.xml
để kiểm tra kết quả. Và kết quả là mình đã xử lý được lỗi Sitemap rồi nhé.
Thêm đánh giá post