Hierarchical Taxonomy Terms Select Menu Output with selected=”selected” Set

In each foreach loop, you’re setting the first item’s ID as the value for $selected which will obviously match the ID of the first item. Before running any of the foreach loops fetch the stored value from the DB then use that for the comparison. global $wpdb; $selected = $wpdb->query( “SELECT something FROM $wpdb->table_name” ); … Read more

Widget dropdown always displays first option

I got an answer on WordPress Support forms, http://wordpress.org/support/topic/widget-dropdown-always-displays-first-option?replies=6 Replaced function form with, function form( $instance ) { // Check values $category = isset( $instance[‘category’] ) ? (int) $instance[‘category’] : ”; $terms = get_terms( ‘app_category’, ‘parent=0&hide_empty=0’ ); if ( !empty( $terms ) && !is_wp_error( $terms ) ) { ?> And changed, name=”<?php echo $this->get_field_name( ‘Category’ … Read more

List of users inside custom taxonomy

get_terms and get_posts return arrays not objects. Try this: <?php $disciplines = get_terms(‘disciplines’); foreach($disciplines as $discipline) { echo ‘<li><a href=”#”>’ . $discipline[‘name’] . ‘</a></li>’; $post_args = array( ‘post_type’ => ‘users’, ‘disciplines’ => $discipline[‘term_id’]); $posts = get_posts( $post_args ); foreach( $posts as $post ){ echo ‘post title: ‘ . $post[‘post_title’] . ‘<br />’; } } ?>

Custom taxonomy link opens under Posts

I had the same problem even though my taxonomy was registered to Users. Found the answer at Custom user taxonomies in WordPress by Justin Tadlock (see the comments for the post). Add this to your code (replace YOUR_TAXONOMY with the proper name): function fix_user_tax_page( $parent_file=”” ) { global $pagenow; if ( ! empty( $_GET[ ‘taxonomy’ … Read more