This WordPress plugin imports posts from CSV (Comma Separated Value) files into your
WordPress blog. It can prove extremely useful when you want to import a bunch
of posts from an Excel document or the like – simply export your document into
a CSV file and the plugin will take care of the rest.
- Imports post title, body, excerpt, tags, date, categories etc.
- Supports custom fields, custom taxonomies and comments
- Deals with Word-style quotes and other non-standard characters using
WordPress’ built-in mechanism (same one that normalizes your input when you
write your posts)
- Columns in the CSV file can be in any order, provided that they have correct
- Multi-language support
This plugin is forked from https://wordpress.org/plugins/csv-importer/ by dvkob
in order to keep up with changes to the core WordPress.
This importer writes directly to the database. It does not go through the internal
WordPress objects for creating posts etc. That may be an advantage to you (it will
be faster for large imports) but do be aware of any data integrity issues that may arrise.
Only UTF-8 encoding is supported, both with and without Byte Order Marks (BOM).
The development repository for this plugin can be found here:
Please feel free to raise issues there, and submit pull requests, as well as through
the normal WordPress channels.
Click on the CSV Importer link on your WordPress admin page, choose the
file you would like to import and click Import. The
inside the plugin’s directory contains several files that demonstrate
how to use the plugin. The best way to get started is to import one of
these files and look at the results.
CSV is a tabular format that consists of rows and columns. Each row in
a CSV file represents a post; each column identifies a piece of information
that comprises a post.
You can create new posts, or update existing posts by supplying the csv_post_id
field pointing to an existing post. When updating, all field names you provide
in the CSV file will be updated – even if blank – but fields you don’t list at
the head of the CSV file will be left intact.
Basic post information
csv_post_id– optional, used to update an existing post.
csv_post_title– title of the post
csv_post_post– body of the post
pageor a custom post type.
csv_post_typecolumn supports custom post types.
Refer to the WordPress
documentation on custom post types for more info
on how to set up custom post types.
csv_post_excerpt– post excerpt
csv_post_categories– a comma separated list of category names or ids.
The list must be enclosed in quotes, e.g. «EC > UK, Island».
If a chain of subcategories does not exist, e.g.
Animalia > Chordata > Mammalia
then they will all be created and the post assigned to the end of the chain.
The parent category can also be defined using its id, e.g.
42 > Primates > Callitrichidae, where
existing category id.
csv_post_tags– a «quoted» comma separated list of tags.
csv_post_date– most standard formats are supported.
last yearare all valid. For technical
details, consult PHP’s
Any column that doesn’t start with
csv_ is considered to be a custom field
name. The data in that column will be imported as the custom fields value.
All custom fields must be unique. Multiple fields with the same name will be
updated to the same value if updating an existing post.
Prior to version 0.6.0 loading the same field name multiple times to an existing
post would create multiple custom fields.
- WordPress pages don’t have categories or tags.
- Most columns are optional. Either
csv_post_excerpt are sufficient to create a post. If all of these
columns are empty in a row, the plugin will skip that row.
- The plugin will attempt to reuse existing categories or tags; if an
existing category or tag cannot be found, the plugin will create it.
- To specify a category that has a greater than sign (>) in the name, use
the HTML entity
csv_post_author– numeric user id or login name. If not specified or
user does not exist, the plugin will assign the posts to the user
performing the import.
csv_post_slug– post slug used in permalinks.
csv_post_parent– post parent id.
New in version 0.3.0
Once custom taxonomies are set up in your theme’s functions.php file or
by using a 3rd party plugin,
csv_ctax_(taxonomy name) columns can be
used to assign imported data to the taxonomies.
The syntax for non-hierarchical taxonomies is straightforward and is essentially
the same as the
The syntax for hierarchical taxonomies is more complicated. Each hierarchical
taxonomy field is a tiny two-column CSV file, where the order of columns
matters. The first column contains the name of the parent term and the second
column contains the name of the child term. Top level terms have to be preceded
either by an empty string or a 0 (zero).
examples/custom-taxonomies.csv file included with the plugin
illustrates custom taxonomy support. To see how it works, make sure to set up
custom taxonomies from
Make sure that the quotation marks used as text delimiters in
columns are regular ASCII double quotes, not typographical quotes like “
(U+201C) and ” (U+201D).
New in version 0.3.1
An example file with comments is included in the
In short, comments can be imported along with posts by specifying columns
csv_comment_*_content etc, where * is
a comment ID number. This ID doesn’t go into WordPress. It is only there
to have the connection information in the CSV file.
- Kevin Hagerty (post_author support)
- Edir Pedro (root category option and tableless HTML markup)
- Frank Loeffler (comments support)
- Micah Gates (subcategory syntax)
- David Hollander (deprecation warnings, linebreak handling)
Installing the plugin:
- Unzip the plugin’s directory into
- Activa el plugin desde el menú ‘Plugins’ de WordPress.
- The plugin will be available under Tools -> CSV Importer on
WordPress administration page.
I have quotation marks and commas as values in my CSV file. How do I tell CSV
Importer to use a different separator?
It doesn’t really matter what kind of separator you use if your file is
properly escaped. To see what I mean by proper escaping, take a look at
examples/sample.csv file which has cells with quotation marks and commas.
If the software you use for exporting to CSV is unable to escape quotation
marks and commas, you might want to give OpenOffice Calc a try.
How can I import characters with diacritics, Cyrillic or Han characters?
Make sure to save your CSV file with utf-8 encoding.
Prior to version 6.0.4, MySQL did not support some rare Han characters. As
a workaround, you can insert characters such as 𠊎 (U+2028E) by
converting them to HTML entities – 𠊎
I cannot import anything – the plugin displays «Imported 0 posts in 0.01
Update to version 0.3.1 or greater. Previous versions required write access to
the /tmp directory and the plugin failed if access was denied by PHP’s safe
mode or other settings.
I’m importing a file, but not all rows in it are imported and I don’t see
a confirmation message. Why?
WordPress can be many things, but one thing it’s not is blazing fast. The
reason why not all rows are imported and there’s no confirmation message is
that the plugin times out during execution – PHP decides that it has been
running too long and terminates it.
There are a number of solutions you can try. First, make sure that you’re not
using any plugins that may slow down post insertion. For example, a Twitter
plugin might attempt to tweet every post you import – not a very good idea
if you have 200 posts. Second, you can break up a file into smaller chunks that
take less time to import and therefore will not cause the plugin to time out.
Third, you can try adjusting PHP’s
max_execution_time option that sets how
long scripts are allowed to run. Description of how to do it is beyond the
scope of this FAQ – you should search the web and/or use your web host’s help
to find out how. However, putting the following line in
.htaccess file inside
public_html directory works for some people:
- Sets max execution time to 2 minutes. Adjust as necessary.
php_value max_execution_time 120
The problem can be approached from another angle, namely instead of giving
scripts more time to run making them run faster. There’s not much I can do to
speed up the plugin (you can contact me at dvkobozev at gmail.com if you like
to prove me wrong), so you can try to speed up WordPress. It is a pretty broad
topic, ranging from database optimizations to PHP accelerators such as APC,
eAccelerator or XCache, so I’m afraid you’re on your own here.
I receive the following error when I try to import my CSV file: «Invalid CSV
file: header length and/or row lengths do not match». What’s wrong with your
Short answer: update to version 0.2.0 or later. Longer answer: the number of
fields (values) in rows in your file does not match the number of columns.
Version 0.2.0 pads such rows with empty values (if there are more columns than
cells in a row) or discards extra fields (if there are less columns than cells
in a row).
I’m getting the following error:
Parse error: syntax error, unexpected. What gives?
T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in .../public_html/wp-content/plugins/csv-importer/File_CSV_DataSource/DataSource.php
on line 61
This plugin requires PHP5, while you probably have PHP4 or older. Update your
PHP installation or ask your hosting provider to do it for you.
Colaboradores y desarrolladores
«CSV Importer Improved» es un software de código abierto. Las siguientes personas han colaborado con este plugin.Colaboradores
Registro de cambios
- Change behaviour of custom fields; treat all fields as unique and don’t create duplicates.
- No functional changes; just a forced update after fixing some SVN issues.
- Fix incorrect intitial status.
- Started making strings translatable.
- Update PHP version to 5.3+
- Support updating existing posts.
- Renamed from «CSV Importer 2» to «CSV Importer Improved».
- Fix some function name clashes with other CSV import plugins.
- Fixes to support WordPress 4.4
- Minor bug and security fixes
- Make hierarchical custom taxonomy line splitting more robust
- Fix deprecation warnings
- Fix category cleanup bug
- Added ‘greater-than’ category syntax
- Updated the docs
- Added csv_post_parent column
- Updated the docs
- Got rid of a deprecation warning
- Fixes incompatibility with versions of WordPress prior to 3.0 introduced
in previous release.
- Added ability to specify custom post type.
- Import comments.
- Updated php-csv-parser – the plugin should no longer create files in /tmp.
- Custom taxonomies.
- Root category selection, cleaner HTML.
- Slight speed increase, support for post_author and post_name.
- Bugfix release to deal with BOM that may occur in UTF-8 encoded files.
- Ability to import rows as pages, not posts.
- Starting with this version, you can also specify category ids instead of
- Ability to handle CSV files where the number of cells in rows does not
match the number of columns
- Smart date parsing
- Code cleanup.
- New option to import posts with published status.
- Added support for post excerpts.
- Code cleanup
- Changed column names for CSV input. Sorry if it breaks anything for you,
folks, but it had to be done in order to allow for custom fields such as
title (All in One SEO Pack uses those, for example).
- Initial version of the plugin