Published on Aug 2, 2025 4 min read

How to Display Custom Taxonomy Terms in WordPress Sidebar Widgets

WordPress allows you to organize posts using tags and categories, but sometimes you need more options. This is where custom taxonomies come in handy, allowing you to arrange content exactly how you want. For instance, a movie blog might use “Genres” or “Topics” to categorize posts. Once developed, you can easily display custom taxonomy terms on your website.

Why Show Custom Taxonomy Terms in the Sidebar?

Displaying taxonomy terms in a sidebar widget enhances your website’s usability, making it easier for users to find content quickly. But how do you display taxonomy in a sidebar? This article outlines two simple methods—using a bit of code or a plugin. Even if you’re not a tech expert, you can follow these guidelines to showcase your custom taxonomy terms effectively.

WordPress Sidebar Widget Example

Understanding Custom Taxonomies

In WordPress, taxonomies help organize and classify content. While the default taxonomies—tags and categories—serve most needs, they’re sometimes not enough. Custom taxonomies offer greater flexibility, allowing you to create labels based on your website’s specific content type or theme, enhancing site navigation and control.

Examples

  • A food blog might use “Cuisine” to group recipes by types such as Italian, Chinese, or Mexican.
  • A bookstore website could use “Author” or “Genre” to categorize books.

Custom taxonomies can be attached to posts, pages, and custom post types, functioning much like tags or categories to speed up content searches and improve user experience.

Custom Taxonomy Example

Methods to Display Custom Taxonomy Terms in the Sidebar

Here are three straightforward techniques to showcase custom taxonomy keywords in your WordPress sidebar:

Method 1: Custom Code Method (For Developers)

If you’re comfortable with programming, you can use a custom function to display terms anywhere on your site or in a widget.

Step 1: Register the Custom Taxonomy

You might have done this already, but if not, here’s an example code to create a new taxonomy called “Genre” for posts:

function create_custom_taxonomy() {
    register_taxonomy(
        'genre',
        'post',
        array(
            'label' => 'Genres',
            'rewrite' => array('slug' => 'genre'),
            'hierarchical' => true,
        )
    );
}
add_action('init', 'create_custom_taxonomy');

Step 2: Display Custom Taxonomy Terms in the Sidebar Widget

Add the following code to your theme’s functions file or a custom plugin:

function display_genre_terms_widget() {
    $terms = get_terms(array(
        'taxonomy' => 'genre',
        'hide_empty' => false,
    ));

    if (!empty($terms) && !is_wp_error($terms)) {
        echo '<ul>';
        foreach ($terms as $term) {
            $term_link = get_term_link($term);
            echo '<li><a href="' . esc_url($term_link) . '">' . esc_html($term->name) . '</a></li>';
        }
        echo '</ul>';
    }
}

function register_genre_widget() {
    register_sidebar(array(
        'name' => 'Custom Taxonomy Sidebar',
        'id' => 'custom_taxonomy_sidebar',
        'before_widget' => '<div class="widget">',
        'after_widget' => '</div>',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
    ));
}
add_action('widgets_init', 'register_genre_widget');

Use this function in your sidebar template:

if (is_active_sidebar('custom_taxonomy_sidebar')) {
    display_genre_terms_widget();
}

Method 2: Plugin Method (No Code Needed)

For those who prefer not to code, using a plugin is an excellent option. Many plugins, like a taxonomy widget plugin, allow widgets to display custom taxonomies.

Recommended Plugin: “Custom Taxonomy Widget”

Steps to Use:

  1. Go to your WordPress dashboard.
  2. Navigate to Plugins > Add New.
  3. Search for “Custom Taxonomy Widget.”
  4. Install and activate it.
  5. Go to Appearance > Widgets.
  6. Drag the Custom Taxonomy widget to your sidebar area.
  7. Choose the taxonomy to display (e.g., Genre).
  8. Save changes.

Your sidebar will now display the taxonomy terms. Most plugins offer display options like dropdown menus or showing post counts.

Method 3: Block Editor Method (Using Shortcode or HTML)

WordPress’s block-based widget editor allows for more flexible design.

Steps to Use:

  1. Go to Appearance > Widgets in your dashboard.
  2. Click “Add Block” in your sidebar area.
  3. Use the “Shortcode” or “Custom HTML” block.
  4. Paste your custom function or shortcode if available.

Certain plugins display taxonomies using shortcodes. You can paste these directly into the widget block.

Styling the Output with CSS

The output will appear plain unless styled. Custom CSS can enhance its appearance.

Sample CSS:

.widget ul {
    list-style: none;
    padding: 0;
}
.widget ul li {
    padding: 5px 0;
}
.widget ul li a {
    color: #0073aa;
    text-decoration: none;
}
.widget ul li a:hover {
    text-decoration: underline;
}

Add this CSS by going to Appearance > Customize > Additional CSS.

Conclusion

Displaying custom taxonomy terms in your WordPress sidebar improves user experience and site navigation. Whether you prefer coding, using plugins, or the block editor, there’s a method suitable for every skill level. Custom taxonomies allow users to find relevant posts by organizing content more efficiently. Including taxonomy terms in your sidebar acts as a great filter, increasing user engagement and enhancing SEO. Don’t forget to style your widgets with CSS for a polished look. By applying these simple techniques, your WordPress site will become more aesthetically pleasing and user-friendly.

Related Articles

Popular Articles