wp_dropdown_categories not displaying custom taxonomy

Hello,

I have created a custom taxonomy:

function dh_year_init() {
    $labels = [
        'name'                  => _x('Years', 'taxonomy general name'),
        'sigular_name'          => _x('Year', 'taxonomy singular name'),
        'menu_name'             => _x('Years', 'Admin Menu text'),
        'all_items'             => __('All Years'),
        'edit_items'            => __('Edit Year'),
        'view_item'             => __('View Year'),
        'update_item'           => __('Update Year'),
        'add_new_item'          => __('Add New Year'),
        'new_item_name'         => __('New Year Date'),
        'parent_item'           => __('Parent Year'),
        'search_items'          => __('Search Years'),
        'not_found'             => __('No Years Found'),
        'back_to_items'         => __('← Back to Years')
    ];
    $args = [
        'labels'                => $labels,
        'description'           => 'The Year the Puzzles were Published',
        'public'                => true,
        'publicly_queryable'    => true,
        'hierarchical'          => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'show_in_nav_menus'     => true,
        'show_in_rest'          => true,
        
    ];
    register_taxonomy('puzzle_year', null, $args);
}
add_action('init', 'dh_year_init');

The Taxonomy is attached to a custom post type, and it all seems to be working until on one page, I try to create a dropdown list where a user can select a choice from the custom taxonomy.

When I try to use:

‘wp_dropdown_categories([
‘taxonomy’ => ‘puzzle_year’,
‘hide_empty=0′
]);’

Nothing populates in the dropdown. It works with the default category, but not my custom taxonomies.

Is there something I am missing?

 

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.

Your Advertisement Here