WordPress.org

Make WordPress Core

Ticket #14268: esc_html_comment_form.php

File esc_html_comment_form.php, 368 bytes (added by scribu, 3 years ago)

Force esc_html() escaping

Line 
1<?php
2
3function comment_edit_filter() {
4        global $pagenow, $comment, $wpdb;
5
6        if ( 'comment.php' != $pagenow )
7                return $comment;
8
9        $raw_content = $wpdb->get_var( $wpdb->prepare( "SELECT comment_content FROM $wpdb->comments WHERE comment_ID = %d", $comment->comment_ID ) );
10        return esc_html( $raw_content );
11}
12add_filter( 'the_editor_content', 'comment_edit_filter' );