Custom filter with custom taxonomy

I have a custom taxonomy register_taxonomy('type', 'blog') where blog is a custom post type.

When I use wp_dropdown_categories to create a custom filter, why it is empty?


add_action ( 'restrict_manage_posts', 'filters' );

function filters () {
    global $typenow;

    if ( 'blog' !== $typenow ) {
        return;
    }

    wp_dropdown_categories (
        array (
            'show_option_all' =>  'All',
            'taxonomy'        =>  get_taxonomy ( 'type' )
        )
    );
}

When I use others like post_tag or category then it works, but it’s empty if use my custom taxonomy.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer