Question about error display in wordpress
Is it possible to display the basic errors on the page rather than with wp_die? For example, display the please enter a comment error above the form rather than landing on the wp_die handler? I've been running for quite a while in the wp-includes folder with the files: wp-comment-post.php, comment-template.php, comment.php
I also had a reaction with this piece of code the error is displayed all the time. But anyway when I send the form I still arrive on wp-comment-post.php with wp_die. I would like to know if we can cancel the redirection to the page that runs the wp_die and display an error on the actual page. Here is my code snippet:
$comment = wp_handle_comment_submission( wp_unslash( $_POST ) );
if ( is_wp_error( $comment ) ) {
$data = (int) $comment-get_error_data();
if ( ! empty( $data ) ) {
$error = 'Comment Submission Failure.';
}
And I call it with in my code with an echo $error