Title: wp_trim_words
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘wp_trim_words’, string $text, int $num_words, string $more, string $original_text )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#wp--skip-link--target)

Filters the text content after words have been trimmed.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#parameters)󠁿

 `$text`string

The trimmed text.

`$num_words`int

The number of words to trim the text to. Default 55.

`$more`string

An optional string to append to the end of the trimmed text, e.g. ….

`$original_text`string

The text before it was trimmed.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/formatting.php#L4086)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/formatting.php#L4086-L4086)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_trim_words()](https://developer.wordpress.org/reference/functions/wp_trim_words/)`wp-includes/formatting.php` |

Trims text to a certain number of words.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_trim_words/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_trim_words%2F)
before being able to contribute a note or feedback.