This is untested but should work since it gives you the data you need to work from and runs prior to the pre_comment_content
filter where the comment is sanitized.
add_filter( 'preprocess_comment', 'wpse_340526_preprocess_comment' );
function wpse_340526_preprocess_comment( $commentdata ) {
if( 'wpse_response' === $commentdata['comment_type'] ){
global $allowedtags;
$allowedtags['pre'] = array('class'=>array());
$allowedtags['h2'] = array();
$allowedtags['h3'] = array();
$allowedtags['h4'] = array();
$allowedtags['h5'] = array();
$allowedtags['h6'] = array();
$allowedtags['ul'] = array();
$allowedtags['ol'] = array();
$allowedtags['li'] = array();
}
return $commentdata;
}
Related Posts:
- setting comments off as default for pages and custom post types?
- Add comments from the admin panel?
- One comment per user per post but be able to reply to existing comments
- Why do I get accidental comments without (the required) email address?
- What are the current recommended best-practices for comments.php?
- How to add editor-style.css styling to wp_editor on front end for comments
- Multiple Comment Moderators and Notifications
- function to remove ‘comments and trackbacks are closed’
- Add a drop down list to comment form?
- If there is a comment_author_link put url around the avatar image
- How can I change the label “Comments” to “Review” everywhere in the WP installation without translation
- How to add a div on comment fields / edited
- How to move comments form above comments list in wordpress
- Remove “Comment” column in all post-types
- How stop the process of submitting a comment if a field is empty?
- Can WordPress store comment cookies on two different computers?
- How to get last comments but not from admin (or other specific user role/capability)?
- Edit Comments Form in TwentyEleven
- Let user edit his own comment
- How can I automatically delete comments that contain chinese / russian signs?
- How to add enctype to multipart/form-data to comment form?
- Comments view limited to 20 results – any way to increase to 50 or 100?
- Changing position of cancel_comment_reply_link and other elements of comment form
- Why do comment moderators need to have all create/edit/delete toboth posts and pages?
- Comment pagination – How to show determined number of comments on the first page?
- Community Moderation Plugin for Comments [closed]
- Allow contributors to moderate comments comments on posts they write
- How do I really disable comments?
- Why is comments_template() working without a comments.php file?
- Comment form connection to Gravity Forms
- Add classname comment template from functions.php
- How to deal with spam comments and distinguish them from non-spam comments?
- Can’t seem to get this CSS to work…any ideas why? [closed]
- Change order of comment fields
- WordPress custom form action url
- comment_post action hook running on page load instead of after a comment is posted
- How to sort posts by the average of comment meta values
- How to get all comment authors of a single post?
- Get return value of wp_insert_comment (comment ID)
- comment_reply_link not work with me
- have_comments() does not work
- How to use the ‘comments_number’ filter?
- Problem with Comment link in Blog [closed]
- Commenting in user profile page?
- Can i Use own Facebook App ID with this Social Comment Plugin? [closed]
- How do i hide all comments from logged out users
- Show Social Sharing Buttons And Facebook Comments In Lightbox Modal Dialog (Image Overlay)?
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- How come pending comments are appearing in admin?
- Generate Sub-Comments with WP-CLI [closed]
- comment_date() & comment_time() not working from functions.php
- Repositioning ‘Reply’ Link in Comments
- Cannot post comments if I don’t post a website?
- How Do I Allow Comment Moderation for Other User’s Posts?
- Make every comment go to the spam folder
- Limit number of comments from get_comments()
- Correct way to retrieve comment attributes for desired results
- The comment could not be saved. No comment_ID on comments
- how to remove WordPress default comment system
- How to get Post title by locale with Qtranslate-X
- ‘comment_post’ hook doesn’t seem to work? [closed]
- Retrieve the last 5 comment URLs
- WordPress comment for virtual page
- count number of all comments by a user on different (non-repeated) posts
- Facebook comments widget – App ID
- Comments screen in backend, how to disable visual editor when replying to a comment
- Genesis Child Theme Modifying Comments display
- Hide Trackbacks/Pingbaks if none exists
- How to use filter on comment submission/insert
- Adding a comment link to the top of every post
- WordPress comment reply link image
- Comment Pagination
- See some statistics about the comments
- Comment form in wordpress theme returns a javascript alert
- How to output comments in Descending order by date using wp_list_comments?
- Re-Direct After Comment Submit IF Comment Comes from Sign-Up Page
- Is there a way to link to the BOTTOM of the comments on a wordpress page?
- How to add inside WordPress comments loop?
- Difference between date and date_gmt
- How do I edit Comments.php so I can add Schema markup to comment output?
- Check if comment author has url
- How to pass settings to comment_form() if theme only uses comments_template()?
- How to enable truly anonymous posting in bbPress forums? [closed]
- Change author, disable comments, enable trackbacks for all items in library
- Prevent author from editing comments from others in their post
- Display Most Recent Three Comments Per Post
- reply to comment excerpt instead of author in comment title
- Does not show comment list
- Can’t post comment to blog in wp-multisite
- Display Comment Form on dedicated Page for each post
- Display facebook comments made on site
- Disable Link to Post from Showing Up in Post’s Comments?
- different levels of nested comments per page
- approve,spam,trash etc. options are not coming on comments in admin panel
- Actual comments not showing, but form is?
- db query for retrieving comments without any reply
- Embed a page within WordPress dashboard?
- Number of unpublished comments for each post
- How can I filter the user avatar displayed in comments? – get_avatar_url filter works everywhere but not in comments
- WordPress Editor widgets “comments” and “post comments form” getting disappeared with elementor [closed]