Tag Info

New answers tagged

0

Ok I find a solution. I use posts_where filter in pre_get_posts. With this filter I can remove the term related WHERE part from the default SQL query. function custom_loops($query) { if (is_tax( 'service_photo_location' )){ $query->set( 'posts_per_page', 10); $query->set( 'post__in', $ids); $query->set( 'orderby', 'title'); ...


0

I'm not sure how you set up looks, but it does seem that you have a lot of taxonomies registered to your post type, so I don't think it will be very viable to use the the exclude parameter in get_terms() to exclude the specific term. What I would suggest is, inside your foreach loop before you declare your query arguments, add the following line if ( ...


0

While I can't guarentee that this is what you are looking for (as you have not posted what your expected output should be), hopefully this will help. Even if it's not exactly what you are looking for, you have the whole object for each term available to you so that you can manipulate the output exactly as you wish. /** Grab the terms within the for the ...


0

You can get the Packages of the current Proposal using wp_get_object_terms() and then pass some/all of those into a WP_Query. $terms = wp_get_object_terms( $post_id, 'packages', array( 'fields' => 'ids' ) ); $args = array( 'post_type' => 'proposals', 'tax_query' => array( array( 'taxonomy' => 'packages', ...


0

A custom taxonomy makes perfect sense - here's hoping I haven't missed something: $songs = get_posts( array( 'post_type' => 'song', ) ); $index = array(); // Build an album_id => songs index foreach ( $songs as $song ) { if ( $albums = get_the_terms( $song->ID, 'album' ) ) $index[ $albums[0]->term_id ][] = $song; ...



Top 50 recent answers are included