WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 6 months ago

#33629 new defect (bug)

Post excerpts have become WAY too long after updating to WP 4.3, please fix.

Reported by: MarineKingAizen Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Formatting Keywords: needs-testing
Focuses: Cc:
PR Number:

Description

I believe this is a bug in the new WP release. After updating, all my websites are in chaos because the post excerpts have become way too long and most themes were not designed to handle it. I'm not the only one to notice this:

https://wordpress.org/support/topic/excerpts-become-full-of-content?replies=14

One user said "WP 4.3 seemed to have changed trunctation from characters to words."

Here's an example of my website before 4.3:
http://i.imgur.com/gUrUhYZ.jpg

and now after 4.3:
http://i.imgur.com/II5l12g.jpg

Change History (11)

#1 @johnbillion
4 years ago

  • Component changed from General to Formatting
  • Keywords needs-testing added

The change made to wp_trim_words() in r33440 might be the culprit here. It changed the translation context of the string which controls whether words or characters are used for the excerpt trimming.

#2 @dd32
4 years ago

@MarineKingAizen are you running WordPress with a non-english locale? If so, which one?

#3 follow-up: @swissspidy
4 years ago

One site mentioned in the support thread referenced above looks like it's using the zh_TW locale.

#4 @MarineKingAizen
4 years ago

My personal website is NOT a non-english locale. My clients aren't either and across different themes (including Magnificent by Elegant Themes, Divi by Elegant themes, varies themes by Ink Themes, etc) all are experiencing the same problem with post excerpts being too long now.

In the meanwhile, a fix was proposed in the thread referenced above. I just thought I would bring this issue to light before making those kinds of changes, I'd prefer no to if possible.

#5 @johnbillion
4 years ago

  • Milestone changed from Awaiting Review to 4.3.1

#6 in reply to: ↑ 3 @SergeyBiryukov
4 years ago

Replying to swissspidy:

One site mentioned in the support thread referenced above looks like it's using the zh_TW locale.

So, zh_CN translated the string as characters_excluding_spaces, and zh_TW as words.

@ocean90, is there a way to track down which locales had characters before [33440] and translated the new string as words? Sounds like we should probably ping them to correct the translations as needed.

#7 @samuelsidler
4 years ago

Just to be sure, I did a quick verification of all English locales to ensure they had translated (or didn't translate) the string properly:

No issues with any of those strings. All report back "words," as expected. To compare, here's the same string (or similar; we changed it in 4.3) from the relevant 4.2 projects (en-NZ doesn't have a 4.2.x translation):

Again, all report back "words," as expected.

How sure are we that this is related to r33440? Has anyone reproduced with stock 4.2.x / 4.3 installs and Twenty Fifteen?

#8 @netweb
4 years ago

See also https://i18n.trac.wordpress.org/changeset/29247/ for zh_CN as they used to ship a custom word count function in their distribution package, this was removed 20th August, ~2 days after WordPress 4.3 was released.

#9 @samuelsidler
4 years ago

  • Keywords close added
  • Milestone changed from 4.3.1 to Awaiting Review

Without further data, there's not much we can do here. It appears to be related to a non-English locale, in which case it will need to get reported to that localization team. If we can track down which locale, I'm happy to contact them.

#10 @wonderboymusic
4 years ago

  • Keywords close removed

#11 @hughc
4 years ago

Just to offer some feedback here, after this issue was reported to me by a site owner.

Their theme (Elegant Theme's Glow) had a custom routine for truncating posts, that took a character count as a parameter. This, in turn called wp_trim_words(), passing the same character count, which, up until 4.3 returned what they expected, a string trimmed to the desired character length.

ie

$output = wp_trim_words( $input, $length, '' );

There is no explicit locale set on the site, but under 4.3, the same call to wp_trim_words() returns words, not characters. Modifying the theme function to use wp_html_excerpt() fixed the issue.

$output = wp_html_excerpt( $input, $length, '' )
Note: See TracTickets for help on using tickets.