How to allow pre tag in WordPress comments?

How to allow pre tag in WordPress comments?

You can add a filter hook for pre_comment_approved:

<?php
function filter_handler( $approved , $commentdata )
{
  // inspect $commentdata to determine approval, disapproval, or spam status
  return $approved;
}

add_filter( 'pre_comment_approved' , 'filter_handler' , '99', 2 );
?>

Reference: https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_approved

Answered by Eric Z Ma.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

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