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

Get parse_query filter to return slug instead of id

taxonomy & term won’t be set (in this case), since query vars are mapped from GET/POST. In other words, $qv[‘large_feature’] = 291 (see wp_edit_posts_query() and WP_Query::get_posts() for the big picture). add_filter( ‘parse_query’,’convert_large_feature_id_to_taxonomy_term_in_query’ ); function convert_large_feature_id_to_taxonomy_term_in_query( $query ) { global $pagenow; $qv =& $query->query_vars; if ( $pagenow == ‘edit.php’ && isset( $qv[‘large_feature’] ) && ctype_digit( $qv[‘large_feature’] … Read more

Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?

Thanks guys. I think I may have found a solution. What I did: On taxonomy-types.php, get all Items for that type using WP_QUERY. Loop through them, use get_the_terms() to get taxonomy Model for each Item Still in the loop: use PHP’s in_array() function and a $model_ids array for unique Model checking Still in the loop: … Read more

Disable block with taxonomies at post page

Use remove_meta_box remove_meta_box( ‘categorydiv’, ‘post-type-name’, ‘side’ ); And hook it to ‘admin_menu’ as in the Codex. function my_remove_cat_box() { remove_meta_box( ‘categorydiv’, ‘post-type-name’, ‘side’ ); } add_action( ‘admin_menu’, ‘my_remove_meta_boxes’ ); I am guessing a little at the first parameter–‘categorydiv’–, but that is what it looks like based on your screen shot.

Custom loop with multiple taxonomy queries

Here’s a function to do a query with multiple taxonomies: function posts_search ($post_type,$taxonomies) { // $taxonomies should be an array (‘taxonomy’=>’term’, ‘taxonomy2’=>’term2’) foreach ($taxonomies as $key=>$value) { $args=array(‘post_type’=>$post_type,’post__in’=>$ids,$key=>$value); unset($ids); $ids=array(); foreach($posts=get_posts($args) as $post) { $ids[]=$post->ID; } if (empty($ids)) return false; } return $posts; } And here’s an example on how i used it in a … 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