Title: Parent location
Last modified: June 2, 2020

---

# Parent location

 *  Resolved [msslrb](https://wordpress.org/support/users/msslrb/)
 * (@msslrb)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/parent-location/)
 * I am trying to place the parent location behind the child location on the manage
   listing page. When I enter “$location->parent” in the template, I get parent 
   location’s ID number instead of the name. How do I get it to display the name?
 * [https://drive.google.com/file/d/1GaPG6–hw9xQ1tAF-JpeDz_NFcO_JVgi/view?usp=sharing](https://drive.google.com/file/d/1GaPG6–hw9xQ1tAF-JpeDz_NFcO_JVgi/view?usp=sharing)

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

 *  Plugin Author [pluginsware](https://wordpress.org/support/users/pluginsware/)
 * (@pluginsware)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/parent-location/#post-12929860)
 * Hi,
 *  As our locations are nothing but WordPress taxonomies, Please refer [https://stackoverflow.com/questions/42620296/wordpress-how-to-get-term-name-from-term-id](https://stackoverflow.com/questions/42620296/wordpress-how-to-get-term-name-from-term-id)
   to get the location name using the location id.
 * Thanks
 *  Thread Starter [msslrb](https://wordpress.org/support/users/msslrb/)
 * (@msslrb)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/parent-location/#post-12931662)
 * Thank you! I got it to display the parent location. However, it displays the 
   parent location of the post before it instead of the current post. Do you know
   how to correct this in my code?
 * $term_id = $location->parent;
 * if ( $has_location && $locations = wp_get_object_terms( $post->ID, ‘acadp_locations’)){
   
   $location_links = array(); foreach ( $locations as $location ) { $location_links[]
   = sprintf( ‘[%s](https://wordpress.org/support/topic/parent-location/%s?output_format=md)‘,
   esc_url(acadp_get_location_page_link( $location ) ), esc_html( $location->name)).”,“.
   $term_name = get_term( $term_id )->name; }

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

The topic ‘Parent location’ is closed to new replies.

 * ![](https://ps.w.org/advanced-classifieds-and-directory-pro/assets/icon-128x128.
   png?rev=1506527)
 * [Advanced Classifieds & Directory Pro](https://wordpress.org/plugins/advanced-classifieds-and-directory-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-classifieds-and-directory-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-classifieds-and-directory-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-classifieds-and-directory-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-classifieds-and-directory-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-classifieds-and-directory-pro/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [msslrb](https://wordpress.org/support/users/msslrb/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/parent-location/#post-12931662)
 * Status: resolved