Loop to return all Woocommerce product tags in alphabetical order
Loop to return all Woocommerce product tags in alphabetical order i am trying to make a loop in WordPress for woocommerce theme to get out all product tags in alphabetical order in a simple way "heading with A below it all tags starts with A letter etc." i am using the code but its return null <?php $tags = get_tags(); $html = '<div class="post_tags">'; foreach ( $tags as $tag ) { $tag_link = get_tag_link( $tag->term_id ); $html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag- >slug}'>"; $html .= "{$tag->name}</a>"; } $html .= '</div>'; echo $html; ?> 2 Answers 2 You can also use a WP_Term_Query with the Woocommerce product tag custom taxonomy, to get all related terms alphabetically by letter: WP_Term_Query $taxonomy = 'product_tag...