Custom field to taxonomy

$brand_name = get_post_meta($post->ID, 'Brand Name', true);

//Brand Meta
$object_term = wp_get_object_terms($post->ID, 'brand');
$object = $object_term[0];
$current_brand = $object->name;

if($current_brand =='' && $brand_name !=''){
wp_set_object_terms($post->ID,$brand_name,'brand');
} else /*Do Nothing*/;

0 Comments

You must be logged in to post a comment.