我有点纠结于以下错误
Illegal string offset \'taxonomy\' in ... on line 175
Trying to get property of non-object in ... on line 177
Trying to get property of non-object in ... on line 178
我使用的代码是:
function tax_cat_active( $output, $args ) {
if(is_single()){
global $post;
$terms = get_the_terms( $post->ID, $args[\'taxonomy\'] );
foreach( $terms as $term )
if ( preg_match( \'#cat-item-\' . $term ->term_id . \'#\', $output ) )
$output = str_replace(\'cat-item-\'.$term ->term_id, \'cat-item-\'.$term ->term_id . \' current-cat\', $output);
}
return $output;
}
add_filter( \'wp_list_categories\', \'tax_cat_active\', 10, 2 );
有人知道如何解决这个错误吗?