How to filter a custom post type by custom taxonomy without 404

When you want to use a taxonomy inside a custom post type URL hierarchy, you have to register it BEFORE the custom post type. Otherwise it won’t work properly. here is a short example: function so305901_register_taxonomies() { $args = [ //your settings ]; register_taxonomy( ‘taxonomy_slug’, [‘custom_post_type_slug’], $args ); } add_action( ‘init’, ‘so305901_register_taxonomies’ ); function so305901_register_custom_post_types() … Read more

How to display custom taxonomy term meta on custom post type

1. If you need to display this informations once. For example in the page header, use get_queried_object(). echo get_term_meta( get_queried_object()->term_id, ‘blue’, true ); echo get_term_meta( get_queried_object()->term_id, ‘red’, true ); echo get_term_meta( get_queried_object()->term_id, ‘green’, true ); 2. If you need to display this informations in the each post, you must create a small loop. $terms = … Read more

Creating a non-hierarchical Taxonomy that behaves like categories

This blog post by “Gazchap” deals with exactly the situation you are, and they updated it after publishing to your follow-up problem: Fortunately, version 4.4 of WordPress introduced a filter – post_edit_category_parent_dropdown_args – that could be used to control the parent terms shown in these meta boxes. It’s designed to let the developer change the … Read more