Lỗi không import file csv WordPres – Khi bạn cần import sản phẩm từ woocommerce website khác qua website WordPress của bạn, mặc định sẽ xuất ra file csv, và khi import sẽ thấy báo lỗi sau:Rất tiếc, định dạng tập tin này không được cho phép vì lý do bảo mật. Loại tập tin không hợp lệ. Chỉ tập tin CSV và TXT được hỗ trợ.
Từ WordPress 4.9.9 trở đi mặc định WordPress không hỗ trợ upload định dạng file .CSV, Để cho phép upload định dạng csv bạn có thể làm theo 1 số cách sau.
Cho phép Upload file csv bằng cách sửa file functions.php của theme
Bạn truy cập vào Admin-> Giao diện-> Sửa giao diện như hình

Tiếp theo bạn chọn file funtions.php và thêm function vào file functions.php
function my_custom_upload_mimes($mimes = array()) {
// Add a key and value for the CSV file type
$mimes[‘csv’] = “text/csv”;
return $mimes;
}
add_action(‘upload_mimes’, ‘my_custom_upload_mimes’);
Tiếp theo bạn mở file wp-config.php và thêm dòng code sau:
define(
'ALLOW_UNFILTERED_UPLOADS'
, true );
Sửa lỗi không cho phép upload file csv bằng cách cài plugin WP Add Mime Types

WP Add Mime Types là plugin giúp mở rộng các định dạng file upload lên website bằng WordPress, như pptxs,xls,odb,odc..


Để cài đặt plugin WP Add Mime Types bạn truy cập Admin-> Plugin -> Cài mới nhập tên plugin WP Add Mime Types, chọn cài đặt rùi kích hoạt pluginKhông chỉ file csv mà file pppts, hay svg cũng sẽ upload lên website được. Tiếp theo bạn cần cài đặt plugin WP Add Mime Types cho phep upload file csv Tuỳ chỉnh plugin WP Add Mime Types cho phép upload file Bạn truy cập Admin-> Cài đặt -> Chọn WP Add Mime Types Admin Settings Copy định dạng cho phép:Sau đó dán xuống dưới: TAB Add Values như hình:Bạn làm tương tự nếu cho phép file svb, docs… Tới đây khi upload file csv sẽ không còn hiển thị lỗi “Sorry, This File Type Is Not Permitted For Security Reasons” hay :Rất tiếc, định dạng tập tin này không được cho phép vì lý do bảo mật
Error Importing CSV File in WordPress
CSV (Comma Separated Values) files are a popular method for transferring data between applications, such as importing and exporting content to and from WordPress websites. However, sometimes when trying to import a CSV file into WordPress, you may encounter errors or issues that prevent the process from completing successfully.
In this article, we will discuss some common reasons behind these errors and provide solutions to help you overcome them.
Common Causes of CSV Import Errors in WordPress
- Incorrect file format: Make sure your CSV file is properly formatted with the correct column headers and values. An improperly formatted or corrupt file can lead to import errors. Open the CSV file in a spreadsheet editor like Microsoft Excel or Google Sheets to verify its structure.
- Character encoding issues: Ensure that your CSV file uses UTF-8 encoding, which is compatible with WordPress. If your file contains special characters (e.g., accents, currency symbols), they might not be imported correctly if the encoding is not set to UTF-8.
- File size limitations: Your web server or hosting provider may have restrictions on the maximum allowed upload size for files. Large CSV files could exceed this limit and fail to import. If possible, split your CSV file into smaller parts or increase the upload limit on your server.
- Incorrect delimiter: The default delimiter for most CSV files is a comma; however, some applications use other delimiters like semicolons or tabs. Confirm that your CSV file uses commas as delimiters or adjust the importing tool settings accordingly.
- Plugin conflicts: Installed plugins on your WordPress site could interfere with the proper functioning of import tools. Temporarily deactivate other plugins while importing your CSV file to check if any of them are causing problems.
- Insufficient user permissions: Ensure you have adequate privileges for uploading and managing files in WordPress (usually an administrator role). You may need to contact your website administrator to obtain the necessary permissions.
Troubleshooting and Solutions
Here are some steps you can take to resolve CSV import errors in WordPress:
- Inspect the CSV file: Open the file in a spreadsheet editor and verify that it’s correctly formatted with appropriate column headers, values, and encoding (UTF-8).
- Check for plugin conflicts: Temporarily deactivate other plugins on your WordPress site and try importing the CSV file again.
- Adjust server settings: If you have access, increase the maximum allowed upload size limit via your web server or hosting provider settings.
- Ensure proper user privileges: Contact your website administrator to confirm that you have adequate permissions for uploading files and managing content in WordPress.
- Seek support from import tool developers: If all else fails, reach out to the developers of the import tool you’re using for assistance or look into alternative import solutions.
In conclusion, there are several potential causes behind errors when importing CSV files into WordPress. By following these troubleshooting tips and solutions, you’ll be able to overcome most issues and successfully import your data into your website.