$wpdb->get_col with multiple tables
-
Hi!
I would like to get all IDs from a custom post type (hoteis) that have in term from a taxonomy (localhotel). I use this in taxonomy-localhotel.php template.I put just a piece of code, because the problem is to make $wpdb getting from multiple tables:
$termoatual = $wp_query->queried_object->term_id;
$sticky_IDs = $wpdb->get_col(“SELECT ID from “.$wpdb->prefix.”posts WHERE post_type = ‘hoteis'”);
$sticky_posts = array_intersect(get_option(‘sticky_posts’),$sticky_IDs);In this part:
$sticky_IDs = $wpdb->get_col(“SELECT ID from “.$wpdb->prefix.”posts WHERE post_type = ‘hoteis'”);i need to get post type hoteis but only with taxonomy localhotel and the term that is actual viewed by template. ($termoatual = $wp_query->queried_object->term_id;)
- The topic ‘$wpdb->get_col with multiple tables’ is closed to new replies.