MySQL query for taxonomy-meta

Try select t.name, t.slug, tm.meta_key, tm.meta_value from wp_term_taxonomy AS tt inner join wp_terms AS t ON tt.term_id = t.term_id inner join wp_termmeta AS tm ON t.term_id = tm.term_id where tt.taxonomy = ‘census-tract’ order by t.name

How to display taxonomy term custom meta (using wp_get_object_terms?)?

If those extra fields are saved on Edit User page you should get them with get_user_meta function: $social_twitter_handle = get_user_meta( $curauth->ID, ‘firm_social_twitter_handle’, true ); If those extra fields are attached to each term you can use get_term_meta function: $firm_terms = wp_get_object_terms( $curauth->ID, ‘firm’ ); if ( ! empty( $firm_terms ) ) { if ( ! … Read more

Get taxonomy singular name instead of taxonomy slug inside $taxonomy query

get_object_taxonomies() by default returns a list of taxonomy names like category and post_tag. If you want the function to return taxonomy objects instead, then set the second parameter to objects: $taxonomies = get_object_taxonomies($custom_post_type_name, ‘objects’); And then change your foreach () code to foreach ($taxonomies as $taxonomy => $tax_object), then use $tax_object->labels->singular_name to access the singular … Read more

Creating conditional to display taxonomy term meta

I ended up adding an additional taxonomy meta class I was then able to use the following to get my phone number: <?php //Get the correct taxonomy ID by slug $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); //Get Taxonomy Meta $saved_data = get_tax_meta($term->term_id,’loc_phone’); ?> <?php if( $saved_data != “” ) { … Read more