WP Inline Comment Errors plug-in
Improve your comment form user experience by displaying instructions for missing fields directly in the page or post with the comment form. Avoid the WordPress default error screen and customize the appearance of your instructions or error messages.
Visit the WordPress plugin page for this plug-in.
Out of the box and without any configuration, the plug-in will display a list of errors in a manner similar to the above screen shot. If your theme uses the default WordPress generated HTML for the comment form fields, then the plug-in will also show an asterisk as a required mark next to the label of the name, email and comment fields. Try it yourself by submitting an empty comment to this post to see a live example of how the errors and indications display.
Here are some of the features the plug-in supports ‘out of the box’ without any configuration.
- When the user submits a comment with an error, instead of trapping the user on the WordPress default error display, the plug-in automatically redirects the browser back to page with the comment form and scrolls down to the comment form so the user can correct errors and try commenting again.
- Prints a list of comment form field errors in between the form title and first field of the form.
- Shows a required field asterisk next to the label for the name/author, email and comment fields.
- Adds the aria-required attribute to these three fields
- Re-posts the HTTP POST data to the form, so the user does not have to retype all of their comment information.
- If your server does not support cookie based sessions and a user has disabled cookies in their web browser, then the plug-in will redirect the user to the WordPress default error display. You can also create your own customized error message template using the provided example error template.
Suggested theme coding changes
The default configuration should handle most of the basic needs for comment form error display. However there are a few coding changes you should consider.
If your server only supports cookie based sessions then you should create your own customized error message template using the provided example error template. This is for the case that an end user has cookies disabled and the plug-in is unable to use a session to direct the user back to the comment form. The plug-in will instead direct the user to your custom error page, offering a better user experience than the WordPress default error display. Y9u can view the plug-in settings page to determine your PHP session configuration and if you need to create the error template.
You should also add style sheet definitions to make the error messages and required field marks stand out.
Customizing the plug-in
If you need more functionality, the plug-in allows you to customize the error display and behaviors to your liking. Follow the links in the side bar menu for explanation of the functions for the plug-in. You can also review the sample code in the plug-in’s examples folder.