How do I display a custom field from a custom taxonomy in single.php?

Catchable fatal error: Object of class stdClass could not be converted to string in /wp-content/themes/new/single.php on line 22 This is because $wpdb->get_row returns an object by default and you can’t echo an object. Changing echo $toc to echo $toc->meta_value will give you your desired result. Your other problem is that multiple terms can have have … Read more

Can’t set custom taxonomy terms via custom form

Have you tried wp_set_object_terms? …which needs to be placed after your call to wp_insert_post as it requires the post ID in order to attach the correct terms, to the right taxonomy with the right post. //add_action(‘plugins_loaded’, ‘newpost’); # will not work, user not authenticated add_action(‘init’, ‘newpost’); // will work, user authenticated function newpost() { if … 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