Skip Navigation

WP All Import Pro add-on for Types mishandles importing date fields

Won't fix

Topic Tags: Import and export

Symptoms

Types date custom fields are stored as timestamps.

The Types add-on for the WP All Import Pro plugin when importing data to a Types date field converts the date given in a CSV or XML file to the expected timestamp before saving.

If the value stored in the CSV/XML file is already a timestamp (e.g. because you exported it from a similar site) this will break the date field, which will not be imported correctly.

Workaround

The Types add-on is created and maintained by the WP All Import Pro team; you may want to report the issue to them.

In the meantime you can edit the plugin directly to resolve the problem.

Edit the file wp-content/plugins/wpai-toolset-types-addon/src/fields/fields/FieldDate.php and locate the definition of the function getFormattedValue (line 70), and change it to:


protected function getFormattedValue($date){
if ( !is_numeric($date) ) {
$date = strtotime(trim($date));
}
return $date;
}

Leave
a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>