Instead of using the Wordpress backend, I've created a form and embedded it into a page. This form will be used by contributors to submit things which will be reviewed prior to posting.
The form will submit to a custom post type.
One of the fields I have is a list field with multiple columns, which looks like:
Amount | Measurement | Ingredient | Notes
This list field is linked to my ingredient custom taxonomy. I'm having trouble with filing the list values to the custom taxonomy.
In my Wordpress backend, I'm using the following to collect the ingredient. Note that i is used because of adding more than one ingredient:
<input type="text" name="ingredient['.$i.'][amount]" />
<input type="text" name="ingredient['.$i.'][measurement]" />
<input type="text" name="ingredient['.$i.'][ingredient]" />
<input type="text" name="ingredient['.$i.'][notes]" />
I'm using the following to file the ingredient:
$the_ingredients = $_POST['ingredient'];
foreach($the_ingredients as $the_ingredient) {
$ingredients[] = $the_ingredient['ingredient'];
}
wp_set_object_terms( $post_id, $ingredients, 'ingredient' );
Any help is greatly appreciated!