1. Home
  2. ReHub Theme
  3. Advanced tips and customizations
  4. Get title of current taxonomy

Get title of current taxonomy

In some cases, you need to get title of current taxonomy. For example, you are making description in category and you want to use title of category in description, but you don’t want to type it each time (maybe you use some kind of autogeneration). Here is shortcode which you can use to get taxonomy name

// Add Shortcode
function rh_get_tax_title( $atts ) {

	// Attributes
	$atts = shortcode_atts(
			'taxonomy' => 'category',

	$tagid = get_queried_object()->term_id; 
	$tagobj = get_term_by('id', $tagid, $atts['taxonomy']);
	$tagname = $tagobj->name;
	return $tagname;

add_shortcode( 'rh_get_tax_title', 'rh_get_tax_title' );

Place in your functions.php How to customize theme

How to use it? SImple. Use

[rh_get_tax_title taxonomy=dealstore]

It’s example how to get Title from custom taxonomy dealstore