Должно работать
add_filter('the_content', 'the_sub');
function the_sub($text) {
if (is_category()) {
$element_class = 'ваш-css-класс';
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
libxml_clear_errors();
$xpath = new DOMXPath($dom);
$elements = $xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $element_class ')]");
$new_content = '';
foreach ($elements as $element) {
$new_content .= $dom->saveHTML($element);
}
return $new_content;
}
return $text;
}