Title: Import serialize empty data problem
Last modified: April 6, 2022

---

# Import serialize empty data problem

 *  Resolved [gerem](https://wordpress.org/support/users/gerem/)
 * (@gerem)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/import-serialize-empty-data-problem/)
 * Hello,
 * I am using your great plugin.
    But I am facing an issue : – I have a template
   that save serialize data : key1/value1, key2/value2 – I have checked : “Do Not
   add empty field in the DB”
 * But in database, if my key2/value2 is empty, that data is save with “”.
 * I think that your plugin must skip the data ?
 * Exemple :
    value1 = value1 value2 = empty
 * Result in database : a:2:{i:0;s:4:”key1″;i:1;s:0:””;}
    Result expected : a:1:{
   i:0;s:4:”key1″;}

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

 *  Thread Starter [gerem](https://wordpress.org/support/users/gerem/)
 * (@gerem)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/import-serialize-empty-data-problem/#post-15541187)
 * I found a way to to this, but the plugin must be updated.
    I put below the code:
   File to modify Path : /wp-import-export-lite/includes/classes/import/class-wpie-
   import-engine.php
 * Line 510, add some code into the if
 *     ```
       if ( ($not_add_empty === 1 && ((is_scalar( $meta_value ) && trim( ( string ) $meta_value ) !== "") || (!empty( $meta_value ))) ) || $not_add_empty !== 1 ) {
   
       									//We delete empty meta_value to not store in DB empty field
       									$new_meta_value = array();
       									foreach ( $meta_value as $array_key => $array_value ) 
       									{
       										if($array_value != "" && !empty($array_value))
       										{
       											$new_meta_value[$array_key] = $array_value;
       										}
       									}
   
       									$meta_value = $new_meta_value;
   
                                           $this->update_meta( $meta_key, $meta_value );
                                       }
       ```
   
    -  This reply was modified 4 years, 1 month ago by [gerem](https://wordpress.org/support/users/gerem/).
 *  Plugin Author [vjinfotech](https://wordpress.org/support/users/vjinfotech/)
 * (@vjinfotech)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/import-serialize-empty-data-problem/#post-15542188)
 * Hi,
 * Thanks for getting in touch
 * We will fix issue as soon as possible.
 * Let me know if you have any questions
 * Thanks and have a nice day
    -  This reply was modified 4 years, 1 month ago by [vjinfotech](https://wordpress.org/support/users/vjinfotech/).
 *  Thread Starter [gerem](https://wordpress.org/support/users/gerem/)
 * (@gerem)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/import-serialize-empty-data-problem/#post-15558661)
 * a little fix of my code : test if the meta_value is an array (ie, if it is a 
   serialized data)
 *     ```
       if ( ($not_add_empty === 1 && ((is_scalar( $meta_value ) && trim( ( string ) $meta_value ) !== "") || (!empty( $meta_value ))) ) || $not_add_empty !== 1 ) {
   
       									if(is_array($meta_value)) //If value is an array, so it is serialize data
       									{
       										//We delete empty meta_value to not store in DB empty field
       										$new_meta_value = array();
       										foreach ( $meta_value as $array_key => $array_value ) 
       										{
       											if($array_value != "" && !empty($array_value))
       											{
       												$new_meta_value[$array_key] = $array_value;
       											}
       										}
   
       										$meta_value = $new_meta_value;
       									}
   
                                           $this->update_meta( $meta_key, $meta_value );
                                       }
       ```
   

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

The topic ‘Import serialize empty data problem’ is closed to new replies.

 * ![](https://ps.w.org/wp-import-export-lite/assets/icon-256x256.png?rev=2129449)
 * [WP Import Export Lite](https://wordpress.org/plugins/wp-import-export-lite/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-import-export-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-import-export-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-import-export-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-import-export-lite/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [gerem](https://wordpress.org/support/users/gerem/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/import-serialize-empty-data-problem/#post-15558661)
 * Status: resolved