Displaying Results From Custom Taxonomy Query

$regions = get_terms(‘region’, array(‘hide_empty’ => false) ); foreach( $regions as $region ){ ?> <li class=”location large-3 columns”> <img src=”https://wordpress.stackexchange.com/questions/126131/<?php echo get_template_directory_uri(); ?>/images/<?php echo $region->slug; ?>.jpg” alt=”” /> <span class=”location-title”><?php echo $region->name; ?></span> </li><?php }

get_terms returns array starting at 4

Run get_terms like this: var_dump(get_terms(‘category’,array(‘hide_empty’=>false))); And then like this: var_dump(get_terms(‘category’)); You should be able to infer what is happening. The first should return the zero based array you expect, with neatly numbered keys. The second does not. The only difference being the hide_empty argument. If you really must have a zero based array just pass … Read more

Pass custom value to custom taxonomy

have you tried building your tag array into a variable and passing that as a parameter to set_post_terms? function add_author_taxonomy( $post_id ) { global $wpdb; if(!wp_is_post_revision($post_ID)) { $my_tags = get_post_meta($post_id, ‘user_submit_customauthor’, true); wp_set_post_terms( $post_id, $my_tags, ‘author’, true ); } } add_action(‘publish_page’, ‘add_author_taxonomy’); add_action(‘publish_post’, ‘add_author_taxonomy’) ;