• I am using following codes to show selected taxonomy name but it show

    “Xdebug: Catchable fatal error: Object of class WP_Term could not be converted to string in C:\wamp\www\wordpress\wp-content\themes\testtheme\content-parts\content-fixture.php on line 34. Output triggered in C:\wamp\www\wordpress\wp-content\plugins\query-monitor\collectors\php_errors.php on line 157


    Metabox code:

    array(
    					'name'				=> __( 'Select Venue', 'themepixels' ),
    					'id'				=> "{$prefix}match_venue_cats",
    					'type'				=> 'taxonomy',
    					'options'			=> array(
    						'taxonomy'		=> 'venue',
    						'type'			=> 'select_advanced',
    						'args'			=> array()
    					),
    					'multiple'			=> false,
    				),

    Frontend code:

      $terms = rwmb_meta( 'pb_match_venue_cats' );
            if ( !empty( $terms ) ) {
                $content = '<ul>';
                foreach ( $terms as $term ) {
                    $content .= sprintf(
                        '<li><a href="%s" title="%s">%s</a></li>',
                        get_term_link( $term, 'venue' ),
                        $term->name,
                        $term->name
                    );
                }
                $content .= '</ul>';
                echo $content;
            }
  • The topic ‘How to show taxonomy value?’ is closed to new replies.