WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp trim excerpt

Description

Generates an excerpt from the content, if needed. Must be used inside the "Loop".

The excerpt word amount will be 55 words and if the amount is greater than that, then the string ' […]' will be appended to the excerpt. If the string is less than 55 words, then the content will be returned as is.

Usage

<?php wp_trim_excerpt$text ?>

Parameters

$text
(string) (optional) The excerpt. If set to empty an excerpt is generated. If you supply text it will be returned untouched. It will not be shortened.
Default: ""(empty string)

Return Values

(string) 
The excerpt.

Examples

Notes

Change Log

Source File

wp_trim_excerpt() is located in wp-includes/formatting.php.

Related

the_excerpt_rss, wp_trim_words

See also index of Function Reference and index of Template Tags.