Support » Plugin: CSV Importer » [Plugin: CSV Importer] Setting serialized meta to not be reserialized on import

  • Hi guy’s,

    I’ve noticed a problem where when I try to import a serialized feild into wordpress with csv importer.

    Say the field is :

    on import it reserializes the feild:


    Is there a way to code a feild header to bypass serialization?

    thank you for any help in advance!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I had the same issue while trying to mass import products into eShop. Around line 539 of the csv_importer.php file I, using WordPress’s is_serialized() function, edited the create_custom_fields() function to unserialize any values to be added to the post meta. In turn add_post_meta() re-serializes any arrays passed through the $meta_value (third) parameter.

    function create_custom_fields($post_id, $data) {
        foreach ($data as $k => $v) {
            // anything that doesn't start with csv_ is a custom field
            if (!preg_match('/^csv_/', $k) && $v != '') {
                // if value is serialized unserialize it
                if( is_serialized($v) ) {
                    $v = unserialize($v);
                    // the unserialized array will be re-serialized with add_post_meta()
                add_post_meta($post_id, $k, $v);

    You could also set it to perform a certain task depending on a specific key.

    if( $k == '_eshop_product' ) {
        $v = unserialize($v);
        // etc., etc.

    Hope this helps.



    Added this to my forked version

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: CSV Importer] Setting serialized meta to not be reserialized on import’ is closed to new replies.