wp_trim_excerpt( string $text = '', WP_Post|object|int $post = null )
Generates an excerpt from the content, if needed.
Description
Returns a maximum of 55 words with an ellipsis appended if necessary.
The 55 word limit can be modified by plugins/themes using the ‘excerpt_length’ filter The ‘ […]’ string can be modified by plugins/themes using the ‘excerpt_more’ filter
Parameters
- $text
-
(Optional) The excerpt. If set to empty, an excerpt is generated.
Default value: ''
- $post
-
(Optional) WP_Post instance or Post ID/object.
Default value: null
Return
(string) The excerpt.
Source
File: wp-includes/formatting.php
Changelog
Version | Description |
---|---|
5.2.0 | Added the $post parameter. |
1.5.0 | Introduced. |