WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the following line to output an unordered list of taxonomies and their associated terms for a custom post type. The only problem with it is that a period gets added after the term.

wp_get_object_terms( $id, the_taxonomies( 'before=<ul><li>&sep=</li><li>&after=</li></ul>' ) );

Here's what it outputs:

<ul><li>Taxname: <a href='http://site.com/taxname/taxterm/'>Taxterm</a>.</li></ul>

Is there an argument I can add to wp_get_object_terms to remove the period?

share|improve this question
up vote 4 down vote accepted

wp_get_object_terms() isn't the problem. the_taxonomies() is doing the outputting; it doesn't return anything.

So, your code is equivalent to:

the_taxonomies( 'before=<ul><li>&sep=</li><li>&after=</li></ul>' );
wp_get_object_terms( $id, null );

Now, if you go to wp-includes/taxonomy.php you will find the dot in the_taxonomies() source.

To remove the dot, you need to add a filter:

function remove_the_dot($template) {
  return '%s: %l';
add_filter('taxonomy_template', 'remove_the_dot');

In case you're wondering, yes, this is an akward way of doing things.

In WP 3.1, you can modify the template simply by passing it as a parameter:

the_taxonomies( array(
  'before' => '<ul><li>',
  'sep' => '</li><li>',
  'after' => '</li></ul>',
  'template' => '%s: %l'
) );
share|improve this answer
Thanks. I'm assuming this line (in get_the_taxonomies) is causing it? $template = apply_filters('taxonomy_template', '%s: %l.'); If so, is there a good way to do this and avoid the periods? – tnorthcutt Feb 11 '11 at 20:42
Yes, it's just under your nose: the 'taxonomy_template' filter. See updated answer. – scribu Feb 11 '11 at 20:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.