Skip to content

Snippet: Define Custom Post Type “Main” Taxonomy (for use with breadcrumbs/related)

add_filter( 'wpex_get_post_type_cat_tax', function( $tax ) {
	if ( 'my-custom-post-type' == get_post_type() ) {
		return 'my-custom-taxonomy';
	}
	return $tax;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top