Title: Map custom post meta to plugin
Last modified: August 24, 2016

---

# Map custom post meta to plugin

 *  [buckneri](https://wordpress.org/support/users/buckneri/)
 * (@buckneri)
 * [11 years ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/)
 * I have created custom Tabs and Fields for my woocommerce products, i made them
   as a plugin so when enabled the fields are active.
 * Is there a way that i can create a plugin or just some code to take your plugin
   and map those meta fields to some column titles so that i can import a file with
   say column “product-sku” and have it import into _custom_sku?
 * The column names will always be the same, but i need to be able to perform these
   imports in multiple websites over and over again.
 * any ideas are appreciated.
 * [https://wordpress.org/plugins/really-simple-csv-importer/](https://wordpress.org/plugins/really-simple-csv-importer/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Takuro Hishikawa](https://wordpress.org/support/users/hissy/)
 * (@hissy)
 * [11 years ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138734)
 * You can convert any column names with filter hooks. There is an example code 
   on my blog post:
    [http://notnil-creative.com/blog/archives/2913](http://notnil-creative.com/blog/archives/2913)
 *  Thread Starter [buckneri](https://wordpress.org/support/users/buckneri/)
 * (@buckneri)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138955)
 * ok i think this was what i needed, now the other question i have is what can 
   i add to that code to set the post_title and post_content values?
 * the code you sent me to is for mapping data to custom meta keys which seems like
   it will work exactly as i need it to, but the csv file i am using will also not
   have the post_title or other mandatory columns for importing so i will need to
   map them from the columns i have. ie i have a column called item-name that would
   need to map to post_title and then i have item-description and that would map
   to post_content
 * any help is appreciated, and if this works, which i think it will ill search 
   your site for a donation button and toss you some money for beer 🙂
 *  Plugin Author [Takuro Hishikawa](https://wordpress.org/support/users/hissy/)
 * (@hissy)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138956)
 * Please use `really_simple_csv_importer_save_post` filter instead. read the docs
 *  Thread Starter [buckneri](https://wordpress.org/support/users/buckneri/)
 * (@buckneri)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138957)
 * yes i’ve read the docs, but i am very new to the whole wordpress filters and 
   plugins area, so i am struggling to figure out how to combine the two solutions,
   as your demo shows how to match a post by unique key, and i cannot get the code
   correct to do all of the above in one run.
 * goals:
    1. none of my csv columns have wordpress post names like “post_title”
   so i need to map “item-name” to “post_title” and other columns to the post table
   data. (post save function) 2. i also need to map “item-name” to “_vendor_item-
   name” in the postmeta table.(meta save function) 3.set post type to custom type
 * i am trying to adjust the really_simple_csv_importer_class to do this because
   it seems that it handles both $post and $meta in the same function, but not having
   a lot of luck.
 * Awesome plugin though, ill keep trying.
 * Thank you
 *  Thread Starter [buckneri](https://wordpress.org/support/users/buckneri/)
 * (@buckneri)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138958)
 * never mind i figured it out, i was thinking too much into it. AWESOME plugin 
   🙂
 *  Thread Starter [buckneri](https://wordpress.org/support/users/buckneri/)
 * (@buckneri)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138959)
 * now i just need to find an export plugin that does the reverse and can put it
   all back into csv in the original order.
 *  Plugin Author [Takuro Hishikawa](https://wordpress.org/support/users/hissy/)
 * (@hissy)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138960)
 * * Not yet tested
 *     ```
       <?php
       /*
       Plugin Name: Map custom post meta to plugin
       Author: Takuro Hishikawa
       Version: 0.1
       Author URI: http://notnil-creative.com/
       */
   
       add_filter('really_simple_csv_importer_class', function(){
           return "CustomImporter";
       });
   
       class CustomImporter
       {
           public function save_post($post,$meta,$terms,$thumbnail,$is_update)
           {
               $itemName = $meta['item-name'];
               unset($meta['item-name']);
   
               $post['post_title']        = $itemName;
               $meta['_vendor_item-name'] = $itemName;
   
               $importer = new RS_CSV_Importer();
               return $importer->save_post($post,$meta,$terms,$thumbnail,$is_update);
           }
       }
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Map custom post meta to plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/really-simple-csv-importer_c5cdac.
   svg)
 * [Really Simple CSV Importer](https://wordpress.org/plugins/really-simple-csv-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/really-simple-csv-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/really-simple-csv-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/really-simple-csv-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/really-simple-csv-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/really-simple-csv-importer/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Takuro Hishikawa](https://wordpress.org/support/users/hissy/)
 * Last activity: [10 years, 12 months ago](https://wordpress.org/support/topic/map-custom-post-meta-to-plugin/#post-6138960)
 * Status: not resolved