get_cat_name is a simple useful function to get the category name from its id in wordpress, there isn’t one for tag (and you cant use the same one…) so here’s I adapted it for tags. TBH its super lazy to be using this, but meh. Uses get_term.
function get_tag_name( $tag_id ) { $tag_id = (int) $tag_id; $tag = get_term( $tag_id, 'post_tag'; ); if ( ! $tag || is_wp_error( $tag ) ) return ''; return $tag->name; }
I am writing Automated Editor, a wordpress plugin which will give you a bunch of pro automation possibilities, in case you were wondering.
One Comment
Hi
thanks for the function that function really helped me alot
Comments Archive
Hi there. This is my old blog and it's archived, so you can no longer post new comments on this post (get_tag_name function for wordpress).
Read my new blog about writing software and stories at WoodyHayday.com