1 2 3 4 5 6 7 8 9 10 11 12 |
<?php $terms = get_terms( array( 'taxonomy' => 'post_tag', 'hide_empty' => false, ) ); ?> <select name="custom_event_tags" id="CustomEventTag"> <option value="">Select a Subject</option> <?php foreach($terms as $tag): ?> <option value="<?php echo $tag->name; ?>"><?php echo $tag->name; ?></option> <?php endforeach; ?> </select> |
1 2 3 |
$tag_id = $_POST['custom_event_tags']; $tag = array( $tag_id ); wp_set_post_terms( $post_id, $tag, 'post_tag' ); |