Posted By

ToddSmithSalter on 01/20/11


Tagged

wordpress customtaxonomy


Versions (?)

Get the name of the selected custom taxonomy


 / Published in: PHP
 

URL: www.centerdrive.ca

Use this to get the name of the custom taxonomy. Note that this only returns the name of the first selected item, but since this returns an array, use a foreach loop to find all names.

  1. // get name of manufacturer of this post
  2. // replace 'manufacturer' with the id name of your custom taxomony
  3. $manufacturer = wp_get_post_terms($post->ID, 'manufacturer');
  4. $manufacturer_name = $manufacturer[0]->name;
  5.  
  6. // use this to display the name
  7. echo $manufacturer_name;

Report this snippet  

You need to login to post a comment.