Show Categories Filter on Custom Post Type List

Found this useful thread on displaying a category filter on a custom post type in wordpress. Here’s the code:

add_action( 'restrict_manage_posts', 'my_restrict_manage_posts' );
function my_restrict_manage_posts() {
	global $typenow;
	$taxonomy = 'your_custom_taxonomy_name';
	if( $typenow != "page" && $typenow != "post" ){
		$filters = array($taxonomy);
		foreach ($filters as $tax_slug) {
			$tax_obj = get_taxonomy($tax_slug);
			$tax_name = $tax_obj->labels->name;
			$terms = get_terms($tax_slug);
			echo "";

WordPress › Support » Show Categories Filter on Custom Post Type List.

  • Misha

    thank u, dude) this is real unique and helpful)

  • Joe Shahi

    This works fine only if there is only one custom post type.If there are more than one custom post type,the category filtering of one custom post type is shown in other custom post type too.How to avoid it and how to add the individual category filtering in individual custom post type?