Posts in loop displaying all taxonomies

You are a victim of WordPress’ great naming scheme. You don’t need get_terms(), but get_the_terms(). Note the the? That makes a huge difference. get_terms( $taxonomies, $args=”” ): Retrieve the terms in a given taxonomy or list of taxonomies. All terms. get_the_terms( $id, $taxonomy ): Retrieve the terms of the taxonomy that are attached to the … Read more

Getting values of a custom taxonomy dropdown

get_user_by() receives user data not taxonomy terms. Since you are not dealing with real userdata you’ll have to use get_term_by() to receive the term name. You would use it like this: $username = get_term_by( ‘id’, (int) $_POST[‘alt_comment_user’], ‘custom_authors’ ); Fixed code: function taxonomy_dropdown() { wp_dropdown_categories( array( ‘name’ => ‘alt_comment_user’, ‘taxonomy’ => ‘custom_authors’, ‘hide_empty’ => false … Read more

Why is the custom taxonomy archive page redirecting me to a single post? [closed]

Taxonomy archive index pages for custom taxonomies are not rendered using archive-{taxonomy}.php, but rather, using taxonomy-{taxonomy}-{term}.php, which falls back to taxonomy-{taxonomy}.php, which falls back to taxonomy.php. Refer to the Template Hierarchy. WordPress interprets archive-{foobar}.php as archive-{post-type}.php, and would use that template to render the archive index for the foobar post-type. So, your artist taxonomy archive … Read more

Adding content to a taxonomy metabox

From core: function post_tags_meta_box($post, $box) { $defaults = array(‘taxonomy’ => ‘post_tag’); if ( !isset($box[‘args’]) || !is_array($box[‘args’]) ) $args = array(); else $args = $box[‘args’]; extract( wp_parse_args($args, $defaults), EXTR_SKIP ); $tax_name = esc_attr($taxonomy); $taxonomy = get_taxonomy($taxonomy); $disabled = !current_user_can($taxonomy->cap->assign_terms) ? ‘disabled=”disabled”‘ : ”; $comma = _x( ‘,’, ‘tag delimiter’ ); ?> <div class=”tagsdiv” id=”<?php echo $tax_name; … Read more

Checking return with WP Error

Not entirely sure what you are asking, but if I understand correctly you want to perform some testing on the return value in order to avoid iterating a WP_Error object and perhaps handle errors in some way. According to the documentation get_terms() will return an array of term objects or false if no objects were … Read more

Getting Term ID from Term Name for WordPress Query

Check for variables names: $excludes=””; if($filtering_excludes) { $exclude_terms = explode(“, “, $filtering_excludes); foreach ($exclude_terms as $exclude_term) { $term = get_term_by( ‘name’, $exclude_term, $filtering_tax ); $exclude_term_array[] = $term->term_id; } $excludes= implode(“, “, $exclude_term_array); }