Shortcode to list (custom) taxonomy terms

I need a shortcode to list terms from a (custom) taxonomy. Can somebody help me?

You can define a shortcode that lists (custom) taxonomy terms by adding this snippet to your functions.php:

function wpkb_shortcode_list_taxonomy_terms($attributes)
    $attributes = shortcode_atts( array(
        'taxonomy' => 'post_tag',
        'orderby' => 'name',
    ), $attributes );

    $args = array(
        'taxonomy' => $attributes['taxonomy'],
        'orderby' => $attributes['orderby'],

    $terms = get_categories($args);

    $output = '';

    // Exit if there are no terms
    if (! $terms) {
        return $output;

    // Start list
    $output .= '<ul>';

    // Add terms
    foreach($terms as $term) {
        $output .= '<li><a href="'. get_term_link($term) .'">'. esc_html($term->cat_name) .'</a></li>';

    // End list
    $output .= '</ul>';

    return $output;

add_shortcode('taxonomy_terms', 'wpkb_shortcode_list_taxonomy_terms');

By default, the shortcode [[taxonomy_terms]] lists the post tags. You can change the taxonomy by modifying the shortcode: [[taxonomy_terms taxonomy=“my_taxonomy”]].