Make WordPress Core

Opened 13 years ago

Last modified 5 years ago

#17039 new defect (bug)

the_excerpt() - <!--more--> handling

Reported by: wpweaver's profile wpweaver Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Formatting Keywords: needs-refresh
Focuses: Cc:


If a post has a manually inserted <!--more--> before the default break at the excerpt length, then the_excerpt() fails to generate any [...] or call the "excerpt_more" filter. Thus, there is no indication that there is more content to the post.

Attachments (2)

17039.diff (1.5 KB) - added by kawauso 13 years ago.
17039.2.diff (1.5 KB) - added by kawauso 13 years ago.
wp_trim_excerpt() isn't fired if post_password_required() is true, so drop internal check

Download all attachments as: .zip

Change History (9)

#1 @kawauso
13 years ago

  • Keywords has-patch added

The issue can be traced back to using get_the_content() in wp_trim_excerpt() which cuts off at <!--more--> regardless of the caller function and doesn't have a more text provided for it.

Following patch splices in a minimal version of the_content() rather than trying to bend the existing code or use a hacky workaround such as $more = 1


  • <!--noteaser--> checks which sets $stripteaser: isn't used unless $more is true
  • if ( count($content) > 1 ): only invokes force_balance_tags() since $more is false and $more_link_text is empty, which is unnecessary since we strip_tags()

Not cut:

  • post_password_required() check, though it's overridden by the_excerpt()
  • $preview check: is this needed?

13 years ago

13 years ago

wp_trim_excerpt() isn't fired if post_password_required() is true, so drop internal check

#2 @kawauso
13 years ago

Last patch does have the slight difference that if it's called by a function other than get_the_excerpt() that fails to replicate the password required check, it will return the actual excerpt rather than a mangled excerptified password form.

#3 @nacin
13 years ago

This was noticed during Twenty Ten development. See #13361 for relevant conversation.

#4 @iandstewart
13 years ago

  • Cc ian@… added

#5 @mfields
12 years ago

  • Cc michael@… added

#6 @nacin
10 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Review to Future Release

See also #25349, somewhat related to the weirdness here.

#7 @chriscct7
9 years ago

  • Keywords needs-refresh added; has-patch 2nd-opinion removed
Note: See TracTickets for help on using tickets.