Display Custom Taxonomies in WordPress Tag Cloud Widget

By default, WordPress tag cloud widget display only the post_tag i.e Tags taxonomy. However, you can easily change this behaviour by adding a small amount of code to your functions.php file.

Quick Tip : Changing the wp_mail from address in WordPress

To display custom taxonomies within the Tag Cloud widget, use the following code.

function custom_tax_tag_cloud_widget($args) {
	$args['taxonomy'] = array('post_tag', 'ingredients');
	return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tax_tag_cloud_widget' );

Also, don’t forget to add your custom taxonomies to the Taxonomy array.

0 Comments

Leave a Comment.