How to import into WordPress using CSV

To develop sites on WordPress I often use the free plugin Types to create your own data types, You can read more about working with the plugin here. Creating your own data types. Types plugin for WordPress.

Today I will tell you how to work with the plugin Types, import data as CSV file. This format is the most convenient for importing..

Our data sample will include:

  • Post title – standard post title in WordPress
  • Property Description – WordPress post text
  • Link to picture - custom field
  • City - custom field
  • Category – taxonomies
  • Object area - custom field

Formatting a CSV File for WordPress Import

CSV importer plugin (CSV importer), which we will use, to import all data, has a very specific file format.

For import to work properly we have to organize the data in the columns of excel spreadsheet. The column headings will tell the plugin, what should it do with the imported data. All column headings must be on the first line (in cell A1). When saving a CSV file, the data is separated by commas. If your data, that need to be transferred to the site in Excel format, then you need to specify the CSV format when saving.

Here are the column headings, to be configured

Content Column name Where is it imported
name of the property csv_post_title Title records
Description of the property csv_post_post The body of the post
Object area wpcf-property-area Custom field that we will set up using the plugin Types. Prefix wpcf- typical for custom custom fields created based on the plugin types and is currently mandatory..
Image link wpcf-link-to-image Link to the image in the field that we will set up later in the lesson.
City wpcf-city wpcf-city custom field types
Category csv_post_categories post_category taxonomy - add csv_ prefix for taxonomy column.
Specifying the data type csv_post_type This field tells the CSV importer which column the record type is in.. In our case, we import into Posts.

note, what we keep talking about records, but import can be done in any content type WordPress. The database table into which messages of all types are imported is called wp_posts.

Let's see, what the prepared Excel file looks like for saving to CSV

CSV Importer для WordPress. Урок по импорту данных.

Now, when the content file is ready, we need to create a custom data type.

Creating a CSV Import Data Type in WordPress

If you don't already have the Types plugin installed, then install it from official WordPress repository.

In this example, we are going to create a custom data type "Properties» and I point, that we use standard WordPress “categories” (Categories) for taxonomy.

custom data type settingscustom data type settings - categories

Create custom fields to import content

Our example requires several custom fields, to do this, go to the menu Types ->Individual types and systematics add a new data type. Fill in all the settings in order in the first metabox. When filling Dynamic data field should always be in English, do not contain spaces or capital letters.

Below we note:

  • in the block Select taxonomists -> Categories;
  • in the block Display Sections add checkboxes next to the items Thumbnail and Individual fields.

Create custom fields to import content

Our example requires several custom fields, which have their own attributes. We will also create them, using plugin Types. Yet again, if you are using types for the first time, you can look at the tutorial creating custom fields using a plugin, it's actually in english, but I think it will not be difficult for you to understand, because with the help Plugin Types this is very easy to do.

Firstly, we will create a group for the new custom fields. As soon as we give the name of the group, we have to specify the type as shown in the picture below.

CSV Importer - create group field - for WordPress lessons

Further, we start adding fields to this group. We have to give the field names like this, as they were listed in the CSV, only without prefixes.

Object area

Object area is a custom field “Single line”.

CSV Importer - create single field - for WordPress lessons

Image link

Link to the image you need to create a field of the type “Image“. This will allow you to view images in your WordPress admin panel and conveniently display them on published pages., using types API (by writing PHP code) or with plugin views, without programming, but it's paid ..

I have one more lesson on working with the Types plugin (data types), it is useful for displaying data without views.

CSV Importer - create image field - for WordPress lessons

City

The City field must be made of the “Single line” type.

CSV Importer - create single field - for WordPress lessons

Import data from CSV

At this stage, you should already have a prepared CSV file. Let's check our file, it should be configured:

  • correct column headers, corresponding to the machine names of each of the generated fields;
  • custom post type, custom fields and taxonomies with correct machine names;
  • plugin CSV importer activated on your site.

We are now doing the actual content import into WordPress.!

  1. In the WordPress admin panel, go to menu (Tools) Tools -> CSV Importer.
  2. Click Select a file (Browse) and point to your pre-created CSV file.
  3. Don't choose import posts as drafts (Import posts as draft) and do not assign categories.
  4. Finally, press the Import button (Import).

Once the import completes and if it succeeds, then we will have brand new WordPress posts. Just go and look at the entries in the Properties data type you created earlier..

CSV Importer - example data

CSV Importer - example csv data

The article was translated from the official website of the developers of the Types plugin:

https://wp-types.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/

If you can't import with your data, try to do all the actions from the lesson step by step.


Buy WordPress hosting
/* WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

5 Responses

  1. admin says:

    Checked everything, lesson 100% operational and finally ready for your attention. Waiting for comments!

  2. Vladimir Kanaryan says:

    All the rules turned out, everything is working, but there is one glitch, Links to previous and next post not showing.

  3. Vladimir Kanaryan says:

    All is good, i already found the solution, The thing is, that when importing CSV, the publication date on all posts is the same, and should differ at least 1 give me a sec. and then everything will be fine, Thank you for efficiency. If you are aware, tell me, the date is filled in the database only in this format? 2013-11-17 15:38:09 or you can set it numerically and somehow convert?

    • admin says:

      Glad it worked out and good experience using imports. I'm not sure about the date, always done in the same format, if you try and succeed, then you can unsubscribe I think it will be useful for many.
      In general, the date output format is set in the wordpress itself in the general parameters, in the admin panel.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal