0

I found out there is a plugins for ticket support. It uses the WordPress comments functions in the ticket system reply.

The issue is the plugin will not accept a line break or with <br.>. How can I make it to accept the <br.> tag or lines break?

                <div class="reply_form">
                    <?php
                    $comments_args = array(
                        'title_reply' => __('Reply', 'orbisius_support_tickets'),
                        'title_reply_to' => '',
                        'label_submit' => __('Send', 'orbisius_support_tickets'),
                        'comment_notes_after' => '',
                        'comment_notes_after' => '',
                        'comment_notes_before' => '',
                        'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . '</label> <textarea id="comment" name="comment" cols="45" rows="5" maxlength="65525" required="required"></textarea></p>',
                    );

Here is the plugin if you are interested.
https://we.tl/t-iLFfJ3wKxH

Live Demo Website with the plugin installed:
https://qwq.rf.gd/?orbisius_support_tickets_data%5Bticket_id%5D=51

Line-break applied. Pictures Examples After Submit, the line-break are not working. After Submit Comments

1 Answer 1

2

On orbisius-support-tickets/modules/core/cpt.php file the comment is sanitised as a single-line input with the function sanitize_text_field() which removes the line breaks. For a textarea field WordPress has sanitize_textarea_field();

Ref: https://developer.wordpress.org/reference/functions/sanitize_textarea_field/

On that file, you can find the line

 $comment = sanitize_text_field( wp_strip_all_tags( $_POST['comment'] ) );

And replace it with:

$comment = sanitize_textarea_field( wp_strip_all_tags( $_POST['comment'] ) );
1
  • Thank you for your help! It works after I added the CSS code! div.reply { white-space: pre-line !important; } appreciate it!
    – Liang
    Commented Oct 10, 2021 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.