How to show all of aspecific post type that has taxonomy and a specific term

Why that $pages suddenly became $myposts!!? Anyway, I really don’t see any big issues with your code, however, you can try this.. <?php $pages = get_posts(array( ‘post_type’ => ‘directory_listing’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘place’, ‘field’ => ‘slug’, ‘terms’ => ‘place1’, ‘include_children’ => false ) )) ); foreach ($pages as $page) … Read more

Archive templates based on taxonomies

If you are trying to display a list of post that belongs to two or more taxonomy terms, you are using the wrong URL. If your are usgin pretty permalinks, it should be: www.example.com/service-provider/?service=electricians&area=north-shore-lower If you are not using pretty permalinks, it should be: www.example.com/?post-type=service-provider&service=electricians&area=north-shore-lower Anyway, you are expected to be in multitax archive page … Read more

Show similar category portfolio items?

Here’s what I would do: I would create a new WP_Query instance, using a Taxonomy parameter as follows: $wp_query = new WP_Query([ ‘post_type’ => ‘<custom_post_type>’, ‘<taxonomy_slug>’ => ‘<term_slug>’, ‘fields’ => ‘ids’, // We just need the post IDs // Add other query parameters as needed ]); More on using Taxonomy parameters in a WP_Query instance … Read more

Child Pages and Custom Taxonomies

You can grab the ID’s of all children and set the post__in argument for your tax query: $child_ids = $wpdb->get_col( “SELECT ID FROM $wpdb->posts WHERE post_parent = $post->ID AND post_type=”page” ORDER BY menu_order” ); $args = array( ‘post__in’ => $child_ids, // Only retrieve taxonomy posts that are children of this page ‘tax_query’ => array( array( … Read more