Custom Taxonomy – Custom Select Query Problem
-
The Following code works but not for all Taxonomies. Any thoughts as to why?
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $custom_post_type = 'shows'; $querystr = " SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta AS date_value ON($wpdb->posts.ID = date_value.post_id AND date_value.meta_key = 'date_value') INNER JOIN $wpdb->term_relationships ON (wp_posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_relationships AS taxonomy ON ($wpdb->posts.ID = taxonomy.object_id) WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = '" . $custom_post_type . "' AND date_value.meta_value >= '" . date('Ymd') . "' AND ( $wpdb->term_relationships.term_taxonomy_id IN ($term->term_id) AND taxonomy.term_taxonomy_id IN ($term->term_id) ) ORDER BY date_value.meta_value, $wpdb->posts.post_title ";
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Taxonomy – Custom Select Query Problem’ is closed to new replies.