add_filter( 'comment_form_field_comment', 'add_private_message_comments' );
function add_private_message_comments( $comment_field ) {
return $comment_field
. '<label><input type="checkbox" name="is_private" value="1" class="private_message"> ' . __('Send with private message.'). '</label>';
}
add_filter('preprocess_comment', 'check_is_private_message' );
function check_is_private_message( $commentdata ) {
$is_private = (int)$_POST['is_private'];
if ( $is_private ){
save_private_message($commentdata);
}else{
return $commentdata;
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.