Building on the momentum generated from the WordPress 4.4 development cycle, WordPress 4.5 includes a number of enhancements to comments. In a post on the Make Core blog, Rachel Baker explains the changes and what to expect.
“WordPress 4.5 includes several ancient bug fixes and a few enhancements in the Comments component. We have closed 25 tickets,” Baker said.
The biggest change users will notice are the design improvements to the comment moderation screen when clicking one of the available links in a comment moderation email. Instead of appearing as a large block of plain-text, comments are formatted as long as they contain the following HTML elements.
- A – Links
- Abbr – Abbreviations
- Acronym – Defines an acronym
- B – Bold
- Blockquote – Specifies a section that is quoted from another source
- Cite – Defines the title of a work
- Code – Defines a piece of computer code
- Del – Defines text that has been deleted from a document
- Em – Emphasizes text
- I – Italicize
- Q – Defines a short quotation
- S – Specifies text that is no longer correct
- Strike – Defines strikethrough text
- Strong – Defines important text
During testing, I noticed that in some cases, the text still appears in a large block as if the paragraph tag is ignored. I’ve already reported this issue to Baker who is looking into it. As you can see, the text that is bold, blockquoted, linked, and italicized, maintains its formatting on the moderation screen.
In addition to visual enhancements, an Edit Comment link was added to the bottom of the comment. In the future, it would be nice to edit a comment in place during the moderation flow, similar to how Quick Edit works, instead of navigating to a different screen. Other notable changes include:
- Updated message styles that match other screens.
- The comment date is only wrapped in a link if the comment permalink exists.
#wpbody-contentis appended to comment moderation email links for accessibility.
rel=nofollowattribute and value pair will no longer be added to relative or same domain links within
WP_Comment_Querynow supports the
- The new
pre_wp_update_comment_count_nowfilter allows you to bail out of updating the comment count for a given Post.
Maximum Comment Field Length
Those who publish lengthy comments will be happy to know that in WordPress 4.5, “the comment fields will enforce the maximum length of each field’s respective database column with hardcoded attributes. The hardcoded limits can be adjusted to accommodate custom database schemas using the
comment_form_default_fields filter,” Baker said. By default, the limits are as follows:
- Comment: 65525 characters
- Name : 245 characters
- Email: 100 characters
- Url: 200 characters
When comments are submitted in 4.5, they’ll be checked by the new
wp_get_comment_fields_max_lengths() function and the
wp_get_comment_fields_max_lengths filter. If a value is more than the limit, a
WP_Error is displayed. If a user publishes a comment and sees an error page, they’ll be able to navigate back to their comment via a link rather than having to use their browser’s back button.
It’s great that comments continue to receive attention, even if there’s a long way to go. Unfortunately, the ability to send a notification email when a comment is approved from moderation was punted to a future release. I’m looking forward to reviewing plugins that allow users to easily configure the comment length limits as seen above. It would be nice to configure the limits so spammers see an error message because of their comment’s length rather than being placed into the moderation queue.
To see and test these improvements yourself, download and install WordPress beta 3 on a test site. If you think you’ve discovered a bug, please create a new post on the Alpha/Beta area of the support forums. What do you think of these changes to comments in WordPress 4.5?