Post Class for Custom Taxonomy Error
I'm getting two errors with the following code. I'm essentially trying to go through all the custom taxonomies and add them to the post class.
Notice: Array to string conversion in /Applications/MAMP/htdocs/Dev/wp-includes/taxonomy.php on line 3317
Notice: Array to string conversion in
/Applications/MAMP/htdocs/Dev/wp-includes/category-template.php on
line 1253
if ( ! function_exists('custom_taxonomy_class') ) {
function custom_taxonomy_class($classes, $class, $ID) {
$args = array(
'public' = true,
'_builtin' = false
);
$output = 'names'; // or objects
$operator = 'and'; // 'and' or 'or'
$taxonomies = get_taxonomies( $args, $output, $operator );
$terms = get_the_terms( (int) $ID, (array)$taxonomies );
if ( ! empty( $terms ) ) {
foreach ( (array) $terms as $order = $term ) {
if ( ! in_array( $term-slug, $classes ) ) {
$classes[] = $term-slug;
}
}
}
$classes[] = '';
return $classes;
}
}
add_filter( 'post_class', 'custom_taxonomy_class', 10, 3 );
Topic custom-taxonomy post-class Wordpress
Category Web