I created a custom post type and some taxonomies. I'm trying to add values for the taxonomies I created. The meta boxes show on the Edit Post screen, but are never populated with values.
Closest I get is new custom fields.
Can someone please confirm what goes where on this function...
add_metadata( $meta_type, $object_id, $meta_key, $meta_value );
Thank you
function eci_populatetaxonomy($recordarray,$csv,$filename,$set,$posttype,$postid)
{
// first check that the post type exists in the taxonomy array
if(isset($csv['taxonomies'][$posttype]))
{
// loop through all set columns - for each column set in array we add that columns data to the taxonomy stored with it
foreach($csv['taxonomies'][$posttype] as $csvcolumn=>$tax)
{
//echo $csvcolumn.'= Column title in data used to extract data value from record array <br />';
//echo $tax.'= Taxonomy name i.e. MyTaxonomy <br />';
if($key != 'NA')
{
// add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false)
$sqlcolumn_clean = eci_cleansqlcolumnname($csvcolumn);
add_metadata('term', $postid, $tax, $recordarray[$sqlcolumn_clean]);// this adds custom fields
//add_metadata($posttype, $postid, $tax, $recordarray[$sqlcolumn_clean]);// this adds custom fields
//add_post_meta($postid, $postid, $tax, $recordarray[$sqlcolumn_clean]);
}
}
}
}