Solved

Wordpress - Get parent taxonomy name for a post

Posted on 2011-09-27
1
556 Views
Last Modified: 2012-05-12
I have a custom post type called 'riders' and a custom taxonomy called 'regions'
A particular rider has a region of 'United States' - which has a parent of "North America.'

I can use get_the_terms() to retrieve the parent ID, but not the parent name.  How can I get the parent name 'North America' for a given post?

0
Comment
Question by:aguawebdesign
1 Comment
 
LVL 31

Accepted Solution

by:
gwkg earned 500 total points
ID: 36714549
Using the term id, you can get the name, slug and description with get_term()

$term = get_term( $term_id, 'regions' );

$name = $term->name;
$slug = $term->slug;
$description = $term->description;
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
google analytics on wp-admin password protected area 2 44
jQuery Toggle & Anchor Links 5 55
Remove a page from Google? 2 38
Wordpress Hacked 1 70
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This video teaches users how to migrate an existing Wordpress website to a new domain.
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question