Enable custom post types categories

When you create custom post types in your WordPress site you may also create custom categories for the new custom post types, and in order to associate the new custom categories taxonomy with the custom post types (for example to use the new categories in the breadcrumbs of the custom posts) you can add the following code snippet filter into your child theme (normally in functions.php file):

add_filter( 'pixfort/custom_types/categories', 'custom_categories_filter', 40, 1 );
function custom_categories_filter($customCats) {
	$new = array(
		'post_slug'	=> 'category_slug'
	);
	return array_merge( $customCats, $new );
}

*Where “post_slug” is the slug of the custom post type and “category_slug” is the slug of the categories of this custom post type.

** If you have multiple custom post types you just need to input each custom post type values in a new line inside $new array.

pixfort
pixfort
Essentials support team
hub.pixfort.com

Hey, this is pixfort support team, if you still need help you can always reach us via the chat messenger in your account on pixfort hub

Related Posts