WordPress.org

Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Really Simple CSV Importer

Alternative CSV Importer plugin. Simple and powerful, best for geeks.

How to debug import data

Really Simple CSV Importer Debugger add-on enables you to dry-run-testing and show more detailed post, meta, taxonomy data of each csv row.
Download from gist.

How to customize import post data

There are three filters available in the importer.

really_simple_csv_importer_save_post

This filter is applied to post data.

Parameters:

  • $post - (array)(required) post data
  • $is_update - (bool) update existing post data, or insert new post data

Example:

function really_simple_csv_importer_save_post_filter( $post, $is_update ) {
    
    // remove specific tag from import data
    if (isset($post['post_tags'])) {
        $_tags = array();
        foreach ($post['post_tags'] as $tag) {
            if ($tag != 'Apple') {
                $_tags[] = $tag;
            }
        }
        $post['post_tags'] = $_tags;
    }
    
    return $post;
}
add_filter( 'really_simple_csv_importer_save_post', 'really_simple_csv_importer_save_post_filter', 10, 2 );

really_simple_csv_importer_save_meta

This filter is applied to post meta data.

Parameters:

  • $meta - (array)(required) post meta data
  • $post - (array) post data
  • $is_update - (bool)

Example:

function really_simple_csv_importer_save_meta_filter( $meta, $post, $is_update ) {
    
    // serialize metadata
    $meta_array = array();
    if (isset($meta['meta_key_1'])) $meta_array[] = $meta['meta_key_1'];
    if (isset($meta['meta_key_2'])) $meta_array[] = $meta['meta_key_2'];
    $meta = array( 'meta_key' => $meta_array );
    
    return $meta;
}
add_filter( 'really_simple_csv_importer_save_meta', 'really_simple_csv_importer_save_meta_filter', 10, 3 );

really_simple_csv_importer_save_tax

This filter is applied to post taxonomy data (categories and tags are not included, these are post data).

Parameters:

  • $tax - (array)(required) post taxonomy data
  • $post - (array) post data
  • $is_update - (bool)

Example:

function really_simple_csv_importer_save_tax_filter( $tax, $post, $is_update ) {
    
    // Fix misspelled taxonomy
    if (isset($tax['actors'])) {
        $_actors = array();
        foreach ($tax['actors'] as $actor) {
            if ($actor == 'Johnny Dep') {
                $actor = 'Johnny Depp';
            }
            $_actors[] = $actor;
        }
        $tax['actors'] = $_actors;
    }
    
    return $tax;
}
add_filter( 'really_simple_csv_importer_save_tax', 'really_simple_csv_importer_save_tax_filter', 10, 3 );

really_simple_csv_importer_save_thumbnail

This filter is applied to thumbnail data.

Parameters:

  • $post_thumbnail - (string)(required) the thumbnail file path or distant URL
  • $post - (array) post data
  • $is_update - (bool)

Example:

function really_simple_csv_importer_save_thumbnail_filter( $post_thumbnail, $post, $is_update ) {

    // Import a local file from an FTP directory
    if (!empty($post_thumbnail) && file_exists($post_thumbnail)) {
        $upload_dir   = wp_upload_dir();
        $target_path  = $upload_dir['path'] . DIRECTORY_SEPARATOR . basename($post_thumbnail);
        if (copy($post_thumbnail, $target_path)) {
            $post_thumbnail = $target_path;
        }
    }

    return $post_thumbnail;
}
add_filter( 'really_simple_csv_importer_save_thumbnail', 'really_simple_csv_importer_save_thumbnail_filter', 10, 3 );

How to customize the post data after importing to database

really_simple_csv_importer_post_saved

This action provides availability to run some tasks after importing.

Example: Download image from remote url to custom field (Download from gist)

How to customize the importing process entirely

really_simple_csv_importer_class

This filter provides availability to completely replace the RS_CSV_Importer#save_post method.

Example: Update row based on a custom field ID/key match (Download from gist)

Requires: 3.6 or higher
Compatible up to: 4.3.6
Last Updated: 2 years ago
Active Installs: 70,000+

Ratings

4.9 out of 5 stars

Support

2 of 8 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
0,1,0
100,1,1
67,3,2 100,1,1
100,1,1 0,2,0
100,1,1
100,2,2
100,2,2
100,1,1
100,2,2
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1