Title: function equivalent to single_term_title();?
Last modified: August 19, 2016

---

# function equivalent to single_term_title();?

 *  [Salum](https://wordpress.org/support/users/salum/)
 * (@salum)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/function-equivalent-to-single_term_title/)
 * So, I’m doing my custom taxonomy page taxonomy-blog_cats.php and I found myself
   before an akward question. How do I get to display the name of the taxonomy? 
   I tried using the_title(); – It returns me the name of the first matched post
 * I tried single_cat_title(); – returns me nothing
 * I tried single_tag_title(); – returns me nothing
 * I tried single_post_title(); – same as the_title();
 * How do I work around this? thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Salum](https://wordpress.org/support/users/salum/)
 * (@salum)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/function-equivalent-to-single_term_title/#post-1553987)
 * anyone? I still can’t figure this out
 *  [Mohammad Jangda](https://wordpress.org/support/users/batmoo/)
 * (@batmoo)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/function-equivalent-to-single_term_title/#post-1554224)
 * According to [this ticket](http://core.trac.wordpress.org/ticket/14161), that
   function will be added in 3.1. Until then you can use this (it’s just a modification
   of single_tag_title):
 *     ```
       if( !function_exists( 'single_term_title' ) ) :
       	function single_term_title($prefix = '', $display = true ) {
       		global $wp_query;
   
       		if ( !is_tax() )
       			return;  
   
       		$term = $wp_query->get_queried_object();
   
       		if ( ! $term )
       			return;
   
       	    $my_term_name = apply_filters('single_tag_title', $term->name);
   
       	    if ( !empty($my_term_name) ) {
       			if ( $display )
       				echo $prefix . $my_term_name;
       			else
       				return $my_term_name;
       		}
       	}
       endif;
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘function equivalent to single_term_title();?’ is closed to new replies.

## Tags

 * [archives](https://wordpress.org/support/topic-tag/archives/)
 * [terms](https://wordpress.org/support/topic-tag/terms/)

 * 2 replies
 * 2 participants
 * Last reply from: [Mohammad Jangda](https://wordpress.org/support/users/batmoo/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/function-equivalent-to-single_term_title/#post-1554224)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
