Updating Custom Posts via CSV Import


I’m writing a plugin so i can regularly upload CSV files to update data in post metas. The problem is that the order of the columns sometimes change with each CSV file i am supplied with. The code i have matches the columns using the number of the column:

$name = trim($csvData[3]);

is there a way to locate the columns by the name of the column instead? (first row of csv) like:

$name = trim($csvData[first_name]);

Agxer 3 months 2021-07-13T23:59:05-05:00 0 Answers 0 views 0

Leave an answer