Skip to content

Instantly share code, notes, and snippets.

@madysondesigns
Created October 18, 2012 15:39
Show Gist options
  • Save madysondesigns/3912634 to your computer and use it in GitHub Desktop.
Save madysondesigns/3912634 to your computer and use it in GitHub Desktop.
Print taxonomy of WP post in loop
In functions.php:
function get_taxonomy() {
$taxonomy = wp_get_object_terms( $post->ID, '[taxonomy]', array("fields" => "names") );
$taxonomy = $taxonomy[0];
echo $taxonomy;
}
In the loop:
<?php get_taxonomy() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment