Title: Excerpt length function written wrong
Last modified: January 12, 2021

---

# Excerpt length function written wrong

 *  Resolved [Erix Kivuti](https://wordpress.org/support/users/elzix/)
 * (@elzix)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/excerpt-length-function-written-wrong/)
 * I initially had a problem with excerpt length.
 * On looking at the code, I realized there’s a problem with the function `get_the_trimmed_excerpt()`.
 * In version 7.0.2, move line 937-953 (entire `if ( mb_strlen( $excerpt )`) to 
   line 955, so that excerpt generated in line 925 is affected by `$this->customs['
   excerpt_length' ]`.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/)
 * (@hinjiriyo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/excerpt-length-function-written-wrong/#post-13898460)
 * What is your problem with the excerpt length?
 *  Thread Starter [Erix Kivuti](https://wordpress.org/support/users/elzix/)
 * (@elzix)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/excerpt-length-function-written-wrong/#post-13900655)
 * Sorry, move to line 957.
 * I want to put the post in footer with a short excerpt length. In line 925, `$
   excerpt` is set, and is not affected by `if ( mb_strlen( $excerpt ) > $this->
   customs[ 'excerpt_length' ] )` in line 938.
 *  Plugin Contributor [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/)
 * (@hinjiriyo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/excerpt-length-function-written-wrong/#post-13911397)
 * This is on purpose. Because HTML code is allowed. Shortening it would lead to
   incorrect syntax, for example, closing HTML elements would be deleted. This can
   lead to errors in the design. Therefore the content is taken over unchanged.
 * So you do the shortening manually on the excerpt.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Excerpt length function written wrong’ is closed to new replies.

 * ![](https://ps.w.org/recent-posts-widget-with-thumbnails/assets/icon-256x256.
   png?rev=2478511)
 * [Recent Posts Widget With Thumbnails](https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/)
 * [Active Topics](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/excerpt-length-function-written-wrong/#post-13911397)
 * Status: resolved