trying to filter the output of term_description to include a class https://codex.wordpress.org/Function_Reference/term_description

function add_class_to_term_description() { ?>

<?php  echo '<div class="cell">' . term_description() . '</div>'; ?>

<?php  }
add_filter( 'term_description', 'add_class_to_term_description' ); ?>

im getting and empty cell class returned hundreds of times which is exhausting the memory. what am i doing wrong?

4 Answers
4

this does the trick

<?php function add_class_to_term_description($term_description) {
  echo '<div class="cell">' . $term_description. '</div>';
}
add_filter( 'term_description', 'add_class_to_term_description' ); ?>

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *