In my functions.php i'm trying to check if the user has selected a value in a custom field drop down and then set that value as the term of the post when it's published. I'm using the following function but it doesn't seem to work. Although if i select a term from the custom taxonomy check list and publish the post the term doesn't get saved. So i guess i'm close? No?
function artist_term_save( $post_ID ){
// Bail if we're doing an auto save
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
//check if they selected your state term
$artist = isset($_POST['magicfields[shop_artist][1][1]']) ? $_POST['magicfields[shop_artist][1][1]'] : ''; //make sure of what the input name is here...
//insert post meta
wp_set_object_terms($post_ID, $artist, 'byartist');
}
Note: magicfields[shop_artist][1][1] is the name of the select drop down in the HTML.