get_the_term_list crashes on different blog
-
Hi there,
i’m working on a project with heavy usage of features introduced in WordPress 3.0. In this very case i have a custom post type with custom taxonomies, which i want to show on a different site than they were created on.
The Post Type exists on Blog 1 and i want to list the posts on Blog 3, which works like a charm. But the function get_the_term_list crashes when used on Blog3 – although the same code works on Blog 1.
The error shown is: Catchable fatal error: Object of class WP_Error could not be converted to string in /var/www/web1/html/wp-content/themes/theme/page-type.php on line 53
The code used to create the output is:
<?php switch_to_blog(1); $querystr = "SELECT * FROM $wpdb->posts as wpost INNER JOIN $wpdb->term_relationships ON (wpost.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) AND $wpdb->term_taxonomy.taxonomy = 'bezug' AND $wpdb->term_taxonomy.term_id IN (666) WHERE wpost.post_status IN ('publish') AND wpost.post_type = 'medien' ORDER BY wpost.post_date DESC LIMIT 0,10"; $medien = $wpdb->get_results($querystr, OBJECT); ?> <?php if ( $medien ): ?> <div class="inhalt presse"> <div class="medien"> <ul> <?php foreach($medien as $post): setup_postdata($post); ?> <li> <div class="datum"><?php the_time('j. F Y'); ?></div> <h3><a href="<?php echo get_post_meta($post->ID, 'link', true);?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php echo get_the_term_list( $post->ID, 'quellen', '<div class="veranstaltungsart"><div class="legende">Veranstaltungsart</div><div class="wert">', ', ', '</div></div><div class="sauber"></div>' ); ?> </li> <?php endforeach;?> </ul> </div> </div> <?php endif; restore_current_blog(); wp_reset_query(); ?>
The same code works perfectly on the original Blog where the content is created. But as soon as i transport the code to another Blog, the List of Terms refuses to work while everything else works perfectly.
Can anybody help me on this one?
Thanks a lot.
Yours,
Christian
- The topic ‘get_the_term_list crashes on different blog’ is closed to new replies.