0

I'm currently working on a Wordpress multisite. While I can retrieve custom post types from within child blogs by using switch_to_blog(1) I cannot retrieve any custom taxonomies this way.

For instance, this page on the main blog lists posts from the "employment" post type and shows the custom "location" category associated with it.

http://209.59.177.85/employment-opportunities/

This one is within a child blog, and the template code is after a call to switch_to_blog(1):

http://209.59.177.85/waterloo/careers/

Same code, but the custom post type shows, and the custom taxonomy does not. The page does not generate any errors. I can't even get a basic term list printed on the page for the taxonomy.

Has anyone done this before?

Thanks!

MauMichael
  • 23
  • 4

1 Answers1

0

Here's the solution, in case anyone is looking. The terms can, of course, be accessed directly from the db:

<span class="date">Location: <?php

$jobid = get_the_ID();

$queryterms = "
            SELECT *
            FROM ".$table_prefix."terms terms, ".$table_prefix."term_taxonomy term_taxonomy, ".$table_prefix."term_relationships term_relationships 
            WHERE (terms.term_id = term_taxonomy.term_id AND term_taxonomy.term_taxonomy_id = term_relationships.term_taxonomy_id)
            AND term_relationships.object_id = ".get_the_ID()."
            ";

            $terms = $wpdb->get_results($queryterms, OBJECT);

            if ( $terms != null ) {
            foreach( $terms as $term ) {

            echo "<a href='/location/";
            print $term -> slug ;

            echo "/'>";

            print $term -> name ;
            echo "</a>";

            unset($term);
            } } ?> | Posted on: <?php the_time('F j, Y'); ?></span>
MauMichael
  • 23
  • 4