Today there is a native option to do this without hacking the core, or doing tricky filters with output buffer. You just need to use the filter 'comment_form_defaults'
and edit the values from 'title_reply_before'
and 'title_reply_after'
key:
add_filter( 'comment_form_defaults', 'custom_reply_title' );
function custom_reply_title( $defaults ){
$defaults['title_reply_before'] = '<span id="reply-title" class="h4 comment-reply-title">';
$defaults['title_reply_after'] = '</span>';
return $defaults;
}
In this exemple, i have wrapped the title with a span tag that have no impact on SEO with a class named .h4
, with a same style that the original h4 tag has:
h4, .h4 {
/* styles */
}
This way, you can keep the styling from a header without messing up with your SEO. (:
If you are using Bootstrap, this class already exists and are styled the same way i mentioned above to all headers. From H1 to H6 and the respective classes.