Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post

you can try with this plugin (or see its code) https://wordpress.org/plugins/wp-better-permalinks/ It allows you change the custom friendly permalinks structure to Custom Post Type > Taxonomy > Post and Custom Post Type > Taxonomy instead of default WordPress structure. it Provides different permalinks structure pattern: Custom Post Type > Single Term (or Term tree) > … Read more

Get all posts for custom taxonomy term

If you only need to display posts assigned to a taxonomy (just a list of posts from each term in your taxonomy without displaying term information) Get only terms IDs: $custom_terms = get_terms( array( ‘taxonomy’ => ‘how-to-guide-type’, //your taxonomy ‘hide_empty’ => true, //ignore terms without posts ‘fields’ => ‘ids’ //return only terms ids )); Now … Read more

Problem registering custom taxonomy

You haven’t passed the labels to register_taxonomy() correctly. That function works the same as register_post_type(), and you need to pass the labels the same way: as part of a ‘labels’ array in the arguments. Please refer to the documentation for the full list of accepted labels, but essentially, you need to organise the arguments this … Read more

Display taxonomies for custom post type

Here is a quick solution, that may guide you to desired result. $years = get_terms( array( ‘taxonomy’ => ‘product-year’, ‘hide_empty’ => true, ) ); $cats = get_terms( array( ‘taxonomy’ => ‘product-cat’, ‘hide_empty’ => true, ) ); if ( ! empty( $years ) && ! is_wp_error( $years ) ){ foreach ( $years as $year ) { … Read more

Query WP Posts, then list the taxonomies from those posts

Use WP_Query with date_query and within loop show only posts with ‘grantees’ taxonomy using is_object_in_term() $args = array( ‘date_query’ => array( array( ‘year’ => 2018, ), ), ); $the_query = new WP_Query( $args ); Then in loop // The Loop if ( $the_query->have_posts() ) { echo ‘<ul>’; while ( $the_query->have_posts() ) { $the_query->the_post(); if( is_object_in_term( … Read more

how to display custom taxonomy on an archive page?

I’m only going to focus on the category listing you have in the code above and ignore the custom query since that’s not what you’re asking about. <?php // I assume the custom taxonomy slug is “basics” $categories = get_the_terms( get_the_ID(), ‘basics’ ); // get_the_terms returns false, a wp error, or an array of term … Read more