I honestly don’t know what the problem is. I can only assume it’s a WordPress issue? Possibly in combination with specific themes or the way specific themes are written. Because this is not causing an issue on every WordPress site.
Just some of them.
Hello,
I started looking into this issue because I’m also having this issue.
A google search of “outputs the wordpress header” shows that there are many sites having this issue.
Hi. For what it’s worth, I’ve figured it out.
Found the answer at WordPress Answers
This is the code I ended up using:
<?php $terms = get_the_terms( $post->ID, 'taxonomy_name' ); ?>
<div class="myclass<?php foreach( $terms as $term ) echo ' ' . $term->slug; ?>">