Action or Filter Hook for a Custom Importer

I’m trying to write a custom bulk importer for store locations but I am struggling with which action hook to use.

I have written it and tested it on a clean WordPress installation and it works fine there but when I try to use it alongside WooCommerce I get an error on every admin page.

I’ve traced the fault back and I think it is being caused by the filter hook I am trying to use.


My import method looks like this:

public function importLocations($newvalue,$option,$oldvalue){
if(‘stockist_settings’==$option && !empty($newvalue[‘fileimport’])){



$prefix = $this->getAttributes()[‘slug’].”_”;
foreach($locations as $location){

// Checks that the longitude and latitude are filled out
if(empty($location[‘Lat’]) || empty($location[‘Lng’])){
$geocoder=new Geocoder();
$lnglat = $geocoder->geocodePostcode($location[‘Postcode’]);


$v = new ValitronValidator($location);
if($v->validate()) {

‘post_title’ => $location[‘CompanyName’],
‘post_type’ => $this->getAttributes()[‘slug’],
‘post_status’ => ‘publish’,
‘meta_input’ => [
$prefix.’address1′ => $location[‘Address1′],
$prefix.’address2’ => $location[‘Address2′],
$prefix.’address3’ => $location[‘Address3′],
$prefix.’city’ => $location[‘City’],
$prefix.’postcode’ => $location[‘Postcode’],
$prefix.’phonenumber’ => $location[‘PhoneNumber’],
$prefix.’website’ => $location[‘Website’],
$prefix.’email’ => $location[‘Email’],
$prefix.’longitude’ => $location[‘Lng’],
$prefix.’latitude’ => $location[‘Lat’],


} else {
// Errors


Is there a better filter hook this I should use or am I approaching the bulk import from the wrong direction entirely?

Read more here:: Action or Filter Hook for a Custom Importer

Leave a Reply

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