Primary Taxonomy for Post

This post is super old but I’ll post my solution here in case anyone else stumbles across this. If you’re using Yoast SEO you can hook into their existing implementation (they do this already for categories). function add_variety_primary_term_taxonomy( $taxonomies, $post_type, $all ) { if( $post_type == ‘product’ && isset( $all[‘my_custom_tax’] ) ) { $taxonomies[‘my_custom_tax’] = … Read more

Create taxonomy from Custom Post Type

Very Simple Code Snippet for Creating Taxonomy for Custom Post Type Register Custom Post Type function Knowledge_base_init() { $labels = array( ‘name’ => _x( ‘Knowledge bases’, ‘post type general name’, ‘your-plugin-textdomain’ ), ‘singular_name’ => _x( ‘Knowledge base’, ‘post type singular name’, ‘your-plugin-textdomain’ ), ‘menu_name’ => _x( ‘Knowledge bases’, ‘admin menu’, ‘your-plugin-textdomain’ ), ‘name_admin_bar’ => _x( … Read more

Custom taxonomy archive templates not found

The page not found error doesn’t mean that the template file is not found/used. Note that a URL returns a 404 status header (not found), then 404.php is used (or index.php if 404.php doesn’t exist). I think your real problem is that you have not flushed the rewrite rules after the taxonomy has been registered. … Read more

$term->taxonomy stripping out underscores

WordPress sees underscore names as relating to post types and dashes as relating to taxonomies. Perhaps this has something to do with it? Also, have you flushed your permalinks recently (change the permalink structure to something else and then back)? It might be stuck in your database with the “sanitized” taxonomy name. This has happened … Read more