New php guy here, so I apologize if I’m using the wrong words or terminology.

I’m working on an old site that has a custom WordPress taxonomy:

register_taxonomy('user-categories',array('user-posts'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'user-categories' ),

This custom taxonomy has a hyphen instead of an underscore in its name. So that means when I try to echo it the hyphen prevents me from referencing it properly like here:

echo '<li><i class="icon-heart"></i> '.$user-categories.'</li>';

In Coda 2 the hyphen turns blue and the word “categories” stops being purple (yes, I know I sound like a complete noob right now). I’ve looked around the net for a way to get the echo line to work, but everything I’ve tried has returned nothing.

Please help! Thank you!

Read more here: Custom Taxonomy has hypen in the variable. How can I echo it?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: